-1

I am trying to develop a portfolio website with Gatsby and Strapi. Everything was working perfectly fine until I tried flooding strapi with some data and while saving it showed "An error occurred", and development server stopped, I tried restarting but showed a lot of errors. I googled the errors and I couldn't solve it. I tried the solution at this as well but it was still unsolved. Someone, please help me with this. After running npm run develop, the output was:

> [email protected] develop C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api     
> strapi develop

[2021-01-29T07:16:16.253Z] debug ⛔️ Server wasn't able to start properly.
[2021-01-29T07:16:16.256Z] error Error: SQLITE_ERROR: duplicate column name: title
    at Client_SQLite3._query (C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api\node_modules\knex\lib\dialects\sqlite3\index.js:99:12)
    at Client_SQLite3.query (C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api\node_modules\knex\lib\client.js:158:17)
    at Runner.query (C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api\node_modules\knex\lib\runner.js:135:36)
    at Runner.<anonymous> (C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api\node_modules\knex\lib\runner.js:228:25)
    at processImmediate (internal/timers.js:461:21)
From previous event:
    at Runner.queryArray (C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api\node_modules\knex\lib\runner.js:227:12)
    at C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api\node_modules\knex\lib\runner.js:37:25
From previous event:
    at Runner.run (C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api\node_modules\knex\lib\runner.js:25:16)
    at SchemaBuilder.Target.then (C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api\node_modules\knex\lib\interface.js:14:43)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] develop: `strapi develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Amit\AppData\Roaming\npm-cache\_logs\2021-01-29T07_16_16_353Z-debug.log     

And the log file:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'develop'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predevelop', 'develop', 'postdevelop' ]
5 info lifecycle [email protected]~predevelop: [email protected]
6 info lifecycle [email protected]~develop: [email protected]
7 verbose lifecycle [email protected]~develop: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~develop: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Amit\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Users\Amit\AppData\Local\Programs\Python\Python39\Scripts;C:\Users\Amit\AppData\Local\Programs\Python\Python39;C:\Users\Amit\AppData\Local\Microsoft\WindowsApps;C:\NewPrograms\flutter\bin;C:\Users\Amit\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Amit\AppData\Roaming\npm
9 verbose lifecycle [email protected]~develop: CWD: C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api
10 silly lifecycle [email protected]~develop: Args: [ '/d /s /c', 'strapi develop' ]
11 silly lifecycle [email protected]~develop: Returned: code: 1  signal: null
12 info lifecycle [email protected]~develop: Failed to exec develop script
13 verbose stack Error: [email protected] develop: `strapi develop`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\Amit\Desktop\Dev\gatsby-strapi-portfolio\portfolio-api
16 verbose Windows_NT 10.0.19041
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "develop"
18 verbose node v14.15.4
19 verbose npm  v6.14.10
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] develop: `strapi develop`
22 error Exit status 1
23 error Failed at the [email protected] develop script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

2 Answers2

0

The key output message is:

error Error: SQLITE_ERROR: duplicate column name: title

According to this GitHub thread: check all the references in your database, the naming and the changes you may did in the usernames and passwords, also double check your local settings file.

Additionally, you can also delete the offending table (title) and remade it again.

On the other hand, on this other GitHub thread they point to update the knex dependency by:

npm update knex
Ferran Buireu
  • 28,630
  • 6
  • 39
  • 67
0

I got similar problem when creating a new content type.

The problem seems to be the actual database keep old setting https://github.com/strapi/strapi/issues/1114

In my case, whole table is duplicated

[2021-07-08T03:13:19.457Z] debug ⛔️ Server wasn't able to start properly. [2021-07-08T03:13:19.458Z] error Error: create table authors (id integer not null primary key autoincrement, name varchar(255) null, published_at datetime null, created_by integer null, updated_by integer null, created_at datetime null default CURRENT_TIMESTAMP, updated_at datetime null default CURRENT_TIMESTAMP) - SQLITE_ERROR: table authors already exists

I deleted the model directory api/author/ . then it's recovered.(but I still can't create author table.)

In your case, it's not about whole table. so editing api/~~~/models/~~~.settings.json may solve.