3

I'm trying to create a sample app, using this article:

https://arjunphp.com/restful-api-using-async-await-node-express-sequelize/

But when a try to execute database migration with sequenze-cli on sqlite, a have always the same error:

C:\WORKING\todo\todos-manager>sequelize db:migrate

Sequelize CLI [Node: 10.16.0, CLI: 5.5.0, ORM: 5.8.12]

Loaded configuration file "config\config.json".
Using environment "development".

ERROR: Please install sqlite3 package manually

I've already tried to rebuild, with no success.

Any ideas?

elena
  • 123
  • 1
  • 11

8 Answers8

1

UPDATE:

the error does not occur if I use the statement:

npx sequelize-cli db:migrate

instead of

sequelize db:migrate

and migration completes successful!

I hope it's useful to someone.

Thanks to all!

elena
  • 123
  • 1
  • 11
1

First install sequelize-cli globally

sudo npm install -g sequelize-cli

Then use the following command to execute migrations.

sequelize db:migrate
1

Might be bit late but writing this for since there is no accepted answer yet :)

I tried with Node10.x , your installed sqlite3 version might not be matching with Node-version, so please switch your version to Node8.x or 9.x.

Use NVM to switch between versions and try avoid installing packages globally.

  • thanks for the answers, can you show which commands you ran? – Chris Sep 16 '20 at 21:09
  • Install nvm and type this command : nvm install 8. Node8 version will get installed, then do nvm list which will show the list of node versions installed in your system. To use specific version, do nvm use . After switching to Node8 version , I did npm install and it worked for me. – Mohamed Niyaz Sirajudeen Sep 17 '20 at 11:04
0

in my case both:
npx sequelize-cli db:migrate
and
sequelize db:migrate
didn't work.
I don't know if its a bad practice but only global installation:
npm i -g sqlite3
solve the issue for me

Eden Sharvit
  • 765
  • 11
  • 14
0

In my case sqllite3 was not installed due to node version mismatch . I switched my node version to v9.11.1 and the error is gone afterwards.

Shravan Hebbar
  • 199
  • 1
  • 7
0

Setting unsafe-perm worked for me:

npm i --unsafe-perm

Elliott de Launay
  • 1,027
  • 13
  • 31
0

If your down here without a fix, it might be possible you have npm postinstall scripts disabled like me. For me the fix was to:

cd project
cd node_modules/sqlite3
npm install
cd ../../
npx sequelize-cli db:migrate

And now it works

Gavin
  • 632
  • 8
  • 10
0

If you have still not been able to get it to work at this stage then run this in the project folder:

npm update

npx sequelize-cli db:migrate
LComingHome
  • 91
  • 2
  • 8