cli icon indicating copy to clipboard operation
cli copied to clipboard

sequelize cli version 3 is unable to run migrations due to missing mysql2?

Open aprilmintacpineda opened this issue 8 years ago • 3 comments

What you are doing?

Trying to run migrations.

What do you expect to happen?

For it to create the tables.

What is actually happening?

npm run db:migrate

> [email protected] db:migrate /Users/me/Documents/projects/mobile-app/backend
> sequelize db:migrate

Sequelize CLI [Node: 8.9.4, CLI: 3.2.0, ORM: 4.31.2]

WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4. https://github.com/sequelize/cli#sequelize-support

Loaded configuration file "config/sequelize.json".
Using environment "development".

ERROR: Please install mysql2 package manually
  • Dialect: Mysql
  • Database version: mysql Ver 14.14 Distrib 5.7.20, for macos10.12 (x86_64) using EditLine wrapper
  • Sequelize CLI version: 3.2.0
  • Sequelize version: 4.31.2

aprilmintacpineda avatar Jan 17 '18 12:01 aprilmintacpineda

Please note that I actually have mysql2 and mysql installed locally, and sequelize-cli installed globally.

aprilmintacpineda avatar Jan 17 '18 23:01 aprilmintacpineda

Finally got it all figured out. I installed sequelize-cli globally and mysql2 locally, so the npm script:

"db:migrate": "sequelize db:migrate"

looks for the package mysql2 globally, to fix this, do npm install --save-dev sequelize-cli, then transform all the scripts to run the locally installed sequelize-cli as said in the documentation node_modules/.bin/sequelize instead. It worked for me after doing all that.

I also uninstalled sequelize-cli globally since it doesn't make sense anymore. Can I get some feedback about this please? I've tried this with other packages, they will always try to find a locally installed dependency first before checking the global scope.

aprilmintacpineda avatar Jan 18 '18 00:01 aprilmintacpineda

none of these work I still get the same warning, can anyone help?

tedrob avatar May 31 '18 06:05 tedrob