Error please install mysql2 package manually

Introduction This is an article where the main focus is to solve an error message. The error appear upon executing […]

Introduction

This is an article where the main focus is to solve an error message. The error appear upon executing a NodeJS application. It is executing a file with the name of ‘db-connect-sequelize.js’ using a nodemon tool. The following is the complete output of the error :

[nodemon] app crashed - waiting for file changes before starting...
,[nodemon] restarting due to changes...
[nodemon] starting `node db-connect-sequelize.js`
/home/admin/nodejs/db/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:81
        throw new Error(`Please install ${moduleName} package manually`);
        ^

Error: Please install mysql2 package manually
    at ConnectionManager._loadDialectModule (/home/admin/nodejs/db/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:81:15)
    at new ConnectionManager (/home/admin/nodejs/db/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:25:21)
    at new MysqlDialect (/home/admin/nodejs/db/node_modules/sequelize/lib/dialects/mysql/index.js:15:30)
    at new Sequelize (/home/admin/nodejs/db/node_modules/sequelize/lib/sequelize.js:340:20)
    at Object. (/home/admin/nodejs/db/db-connect-sequelize.js:4:12)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
[nodemon] app crashed - waiting for file changes before starting...

The application is just a simple application. The error appear when a certain line of code is added. The following is the actual line of code where it finally trigger the error :

const db = new sequelize("","","",{
        host: "10.0.2.2",
        dialect: "mysql"
});

The solution to solve the error message is simple. Just install the module for solving the problem. There is a line informing that solution for solving the problem in the above error message output. The following is pointing out that line :

Error: Please install mysql2 package manually

So, just install ‘mysql2’ module. In order to do so, there is an article with the title of ‘How to Install mysql2 Module in NodeJS Application’ in in this link as a reference. The following is the actual execution of the mysql2 module installation :

[admin@10 db]$ npm i mysql2

added 12 packages, and audited 208 packages in 4s

11 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[admin@10 db]$

Since the execution is using a nodemon tool, after the ‘mysql2’ module exist from the installation process, the following output appear :

[nodemon] restarting due to changes...
[nodemon] starting `node db-connect-sequelize.js`
Testing !
Listening on port 3001
Executing (default): SELECT 1+1 AS result
Connected to the database !

As in the above output command execution, the process for solving the problem is finish.

When using the sequalize db:migrate command I am getting the following error. Looking at some of the previous comments on similar issues people said it is a dependency issue but whenever I run

npm install mysql2

or

npm install -g mysql2

I get the same error.

[email protected]:/mnt/c/Users/larry/Desktop/node/AAF-NodeJS$
sequelize db:migrate

Sequelize CLI [Node: 10.1.0, CLI: 4.0.0, ORM: 4.37.10]

(node:2241) ExperimentalWarning: The fs.promises API is experimental
Loaded configuration file "db/config/database.json".
Using environment "development".

ERROR: Please install mysql2 package manually

Here is my package.json like some of you have asked for.

{
  "name": "aaf-website-node",
  "version": "0.0.1",
  "description": "Nodejs implementation of the achieve anything website",
  "main": "app.js",
  "scripts": {
    "start": "node bin/www",
    "dev": "node node_modules/nodemon/bin/nodemon.js bin/www",
    "test": "jasmine",
    "console": "node console.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/AchieveGirl/AAF-NodeJS.git"
  },
  "keywords": [
    "nodejs",
    "express"
  ],
  "author": "Larry Cherry",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/AchieveGirl/AAF-NodeJS/issues"
  },
  "homepage": "https://github.com/AchieveGirl/AAF-NodeJS/blob/master/README.md",
  "dependencies": {
    "body-parser": "^1.18.2",
    "bootstrap": "^4.0.0",
    "compression": "^1.7.2",
    "cookie-parser": "^1.4.3",
    "dotenv": "^5.0.1",
    "ejs": "^2.5.7",
    "eslint": "^4.19.1",
    "express": "^4.16.3",
    "express-ejs-layouts": "^2.3.1",
    "express-minify": "^1.0.0",
    "express-minify-html": "^0.12.0",
    "jquery": "^3.3.1",
    "lodash": "^4.17.5",
    "morgan": "^1.9.0",
    "mysql2": "^1.5.3",
    "node-fetch": "^2.1.2",
    "node-minify": "^2.4.1",
    "popper.js": "^1.14.3",
    "sequelize": "^4.37.10",
    "sequelize-cli": "^4.0.0",
    "serve-favicon": "^2.4.5",
    "webpack": "^4.1.1",
    "webpack-cli": "^2.0.12"
  },
  "devDependencies": {
    "nodemon": "^1.17.2",
    "pryjs": "^1.0.3"
  }
}

При использовании команды sequalize db: мигрировать я получаю следующую ошибку. Глядя на некоторые из предыдущих комментариев по аналогичным вопросам, люди говорили, что это проблема зависимости, но всякий раз, когда я запускаю

npm install mysql2

Или же

npm install -g mysql2

Я получаю ту же ошибку.

larry@DESKTOP-NSSNPRR:/mnt/c/Users/larry/Desktop/node/AAF-NodeJS$
sequelize db:migrate

Sequelize CLI [Node: 10.1.0, CLI: 4.0.0, ORM: 4.37.10]

(node:2241) ExperimentalWarning: The fs.promises API is experimental
Loaded configuration file "db/config/database.json".
Using environment "development".

ERROR: Please install mysql2 package manually

Вот мой package.json, как некоторые из вас просили.

{
  "name": "aaf-website-node",
  "version": "0.0.1",
  "description": "Nodejs implementation of the achieve anything website",
  "main": "app.js",
  "scripts": {
    "start": "node bin/www",
    "dev": "node node_modules/nodemon/bin/nodemon.js bin/www",
    "test": "jasmine",
    "console": "node console.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/AchieveGirl/AAF-NodeJS.git"
  },
  "keywords": [
    "nodejs",
    "express"
  ],
  "author": "Larry Cherry",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/AchieveGirl/AAF-NodeJS/issues"
  },
  "homepage": "https://github.com/AchieveGirl/AAF-NodeJS/blob/master/README.md",
  "dependencies": {
    "body-parser": "^1.18.2",
    "bootstrap": "^4.0.0",
    "compression": "^1.7.2",
    "cookie-parser": "^1.4.3",
    "dotenv": "^5.0.1",
    "ejs": "^2.5.7",
    "eslint": "^4.19.1",
    "express": "^4.16.3",
    "express-ejs-layouts": "^2.3.1",
    "express-minify": "^1.0.0",
    "express-minify-html": "^0.12.0",
    "jquery": "^3.3.1",
    "lodash": "^4.17.5",
    "morgan": "^1.9.0",
    "mysql2": "^1.5.3",
    "node-fetch": "^2.1.2",
    "node-minify": "^2.4.1",
    "popper.js": "^1.14.3",
    "sequelize": "^4.37.10",
    "sequelize-cli": "^4.0.0",
    "serve-favicon": "^2.4.5",
    "webpack": "^4.1.1",
    "webpack-cli": "^2.0.12"
  },
  "devDependencies": {
    "nodemon": "^1.17.2",
    "pryjs": "^1.0.3"
  }
}

When using the sequalize db:migrate command I am getting the following error. Looking at some of the previous comments on similar issues people said it is a dependency issue but whenever I run
npm install mysql2
or
npm install -g mysql2
I get the same error.
larry#DESKTOP-NSSNPRR:/mnt/c/Users/larry/Desktop/node/AAF-NodeJS$
sequelize db:migrate
Sequelize CLI [Node: 10.1.0, CLI: 4.0.0, ORM: 4.37.10]
(node:2241) ExperimentalWarning: The fs.promises API is experimental
Loaded configuration file "db/config/database.json".
Using environment "development".
ERROR: Please install mysql2 package manually
Here is my package.json like some of you have asked for.
{
"name": "aaf-website-node",
"version": "0.0.1",
"description": "Nodejs implementation of the achieve anything website",
"main": "app.js",
"scripts": {
"start": "node bin/www",
"dev": "node node_modules/nodemon/bin/nodemon.js bin/www",
"test": "jasmine",
"console": "node console.js"
},
"repository": {
"type": "git",
"url": "https://github.com/AchieveGirl/AAF-NodeJS.git"
},
"keywords": [
"nodejs",
"express"
],
"author": "Larry Cherry",
"license": "MIT",
"bugs": {
"url": "https://github.com/AchieveGirl/AAF-NodeJS/issues"
},
"homepage": "https://github.com/AchieveGirl/AAF-NodeJS/blob/master/README.md",
"dependencies": {
"body-parser": "^1.18.2",
"bootstrap": "^4.0.0",
"compression": "^1.7.2",
"cookie-parser": "^1.4.3",
"dotenv": "^5.0.1",
"ejs": "^2.5.7",
"eslint": "^4.19.1",
"express": "^4.16.3",
"express-ejs-layouts": "^2.3.1",
"express-minify": "^1.0.0",
"express-minify-html": "^0.12.0",
"jquery": "^3.3.1",
"lodash": "^4.17.5",
"morgan": "^1.9.0",
"mysql2": "^1.5.3",
"node-fetch": "^2.1.2",
"node-minify": "^2.4.1",
"popper.js": "^1.14.3",
"sequelize": "^4.37.10",
"sequelize-cli": "^4.0.0",
"serve-favicon": "^2.4.5",
"webpack": "^4.1.1",
"webpack-cli": "^2.0.12"
},
"devDependencies": {
"nodemon": "^1.17.2",
"pryjs": "^1.0.3"
}
}

So I finally figured out the bug. The issue appears to come from when you are calling the migration from global install of sequelize-cli instead of the locally installed version of sequelize in my project. All I had to do was call the script form the node modules folder and it worked perfectly. I was calling the command this way sequelize db:migrate when I needed to call the local installed package this way node_modules/.bin/sequelize db:migrate

The reason that you getting an error message to prompt you to install the mysql2 module is because of the db:migrate command is relied on the mysql2 but as an optionalDependencies, so you have to install the mysql2 module manually

This one worked for me
npm install mysql2 --save

Related

Facing issue while installing Keystone#next 4.0 beta

I am having issue while installing Keystone#next ( beta version).I am using below command.
i did npm init in D:/keystone drive
npm install --save keystone#next
I am just getting node modules using the installation steps provided on keystone github dir, and missing the core files to run keystone project.
GitHub : https://github.com/keystonejs/keystone#keystone-40-beta-released
Try generator-keystone. You need to install Yeoman before using generator-keystone. I used Yeoman generator a few months ago and it installed the beta version of KeystoneJS for me at that time:
$ cat Documents/brand-keystonejs/package.json
{
"name": "studio",
"version": "0.0.0",
"private": true,
"dependencies": {
"async": "2.1.4",
"cloudinary": "1.7.0",
"connect-mongo": "^2.0.0",
"dotenv": "4.0.0",
"express-handlebars": "3.0.0",
"handlebars": "4.0.6",
"keystone": "4.0.0-beta.5",
"lodash": "^4.13.1",
"moment": "2.17.1",
"node-sass": "4.5.0",
"node-sass-middleware": "0.11.0"
},
"devDependencies": {
"eslint": "3.15.0",
"eslint-config-keystone": "3.0.0",
"eslint-plugin-react": "^5.1.1"
},
"scripts": {
"lint": "eslint .",
"start": "node keystone.js"
}
}

hummus module causing npm install to fail

I've tried to run my node project on my windows,
but when I want to use the command:
npm install or npm update
it shows the errors below
I have already removed node and reinstalled it, but there is still the same issue.
os: windows 10
node version: 8.8.1
npm version: 5.4.2
my package.json file
{
"name": "mytasklist",
"version": "1.0.0",
"description": "Simple task manager",
"main": "server.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"binary": "^0.3.0",
"body-parser": "^1.17.2",
"dataformat": "^1.0.0",
"dateformat": "^2.0.0",
"ejs": "^2.5.7",
"express": "^4.15.4",
"fs": "0.0.1-security",
"fs-extra": "^4.0.2",
"html-pdf": "^2.2.0",
"hummus": "^1.0.83",
"js-base64": "^2.3.2",
"js-sha256": "^0.6.0",
"mocha": "^4.0.1",
"mongojs": "^2.4.0",
"mssql": "^4.1.0",
"multer": "^1.3.0",
"node-base64-image": "^1.0.4",
"node-pdftk": "^1.1.1",
"pdfkit": "^0.8.3",
"pdftohtmljs": "^0.4.2",
"phantom-html-to-pdf": "^0.5.5",
"phantomjs": "^2.1.7",
"request": "^2.81.0",
"requests": "^0.2.2",
"sha256": "^0.2.0",
"soap": "^0.21.0",
"tedious": "^2.0.0",
"winston": "^2.3.1",
"winston-daily-rotate-file": "^1.4.6"
}
}
The error does not seem to come from npm but from your dependencies. So you can try the following.
The error seems to come from the dependency: hummus. The error message indicates that you need to have python in your system. You can consider installing python and then after retry to install the hummus module. The following link can also give a hint. If it does not work, you might consider restarting from the scratch.
Restart from the scratch
Remove your package.json file. Initialize your project npm init and reinstall your dependencies one after another. Then, you will be able to identify which dependency is causing your install to fail.

Heroku cannot find module ‘Sequelize’

I'm getting the error heroku cannot find module 'Sequelize' when the server runs npm start on index.js file. When I run it locally by command heroku local it works fine. What I don't understand is that there is no module called 'Sequelize' in my project. It's called in lower case sequelize. Here's my package.json
{
"name": "anonbay",
"version": "1.0.0",
"description": "social network app",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "saud",
"license": "ISC",
"dependencies": {
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.16.0",
"express": "^4.14.0",
"express-graphql": "^0.6.3",
"express-session": "^1.15.3",
"graphql": "^0.9.1",
"graphql-subscriptions": "^0.3.1",
"lodash": "^4.17.4",
"mongoose": "^4.7.7",
"pg": "^6.1.2",
"pg-hstore": "^2.3.2",
"sequelize": "^3.30.4",
"subscriptions-transport-ws": "^0.6.0"
}
}
My bad I was importing 'Sequelize' with uppercase. It works locally but it seems heroku is case sensitive. Changed it to 'sequelize' and it worked

Travis give error but compiles on pc

I'm making a web server with Node.JS and use Travis-Ci to check my code. Yhe problem I got is when I commit my code, Travis gives error below, but the code compiles without an error on my pc:
./backend/server.js: 1: Syntax error: ( unexpected
Here you could find my .travis.yml file:
install:
- npm install
- npm install -g bower
- bower install bootstrap
- bower install socket.io
language: node_js
node_js:
- "6.9"
before_script:
- chmod 0777 ./backend/server.js
cache:
directories:
- node_modules
- bower_components
and the package.json
{
"name": "watchfriends",
"version": "0.0.0",
"description": "Front-end and back-end project watchfriends",
"main": "gulpfile.js",
"scripts": {
"test": "./backend/server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/WatchFriends/Backend.git"
},
"author": "Hein P., Jasper D., Michiel V., Michiel Z.",
"license": "ISC",
"bugs": {
"url": "https://github.com/WatchFriends/Backend/issues"
},
"homepage": "https://github.com/WatchFriends/Backend#readme",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-clean-css": "^2.0.13",
"gulp-concat": "^2.6.1",
"gulp-csslint": "^1.0.0",
"gulp-htmlhint": "^0.3.1",
"gulp-jshint": "^2.0.4",
"gulp-notify": "^2.2.0",
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^2.2.0",
"gulp-uglify": "^2.0.0",
"jshint-stylish": "^2.2.1"
},
"dependencies": {
"socket.io": "^1.5.1"
}
}
On this gist, you could find my code, including the log.
Did I something wrong?
Thanks in advance.
Travis runs npm test when testing your code.
If you check inside of your "package.json" file then you can see that the test script is set to run ./backend/server.js. You need to run the node file with node.
Change that to node ./backend/server.js and hopefully that'll work.

Ember-cli-dependency-checker — Invalid Version: *

I am trying to upgrade a project's devDependencies and encounter this error.
I can't figure out why I'm getting this error.
What package does it think is invalid? Itself?
Do I have to look in every package.json?
[folatt#ArkOS_Dev genesis]$ sudo ember update
Invalid Version: *
TypeError: Invalid Version: *
at new SemVer (/home/folatt/workspace/arkos/genesis/node_modules/semver/semver.js:295:11)
at Range.test (/home/folatt/workspace/arkos/genesis/node_modules/semver/semver.js:1049:15)
at Function.satisfies (/home/folatt/workspace/arkos/genesis/node_modules/semver/semver.js:1098:16)
at Function.VersionChecker.satisfies (/home/folatt/workspace/arkos/genesis/node_modules/ember-cli-dependency-checker/lib/version-checker.js:31:17)
at Package.updateRequired (/home/folatt/workspace/arkos/genesis/node_modules/ember-cli-dependency-checker/lib/package.js:21:26)
at Package.init (/home/folatt/workspace/arkos/genesis/node_modules/ember-cli-dependency-checker/lib/package.js:15:27)
at new Package (/home/folatt/workspace/arkos/genesis/node_modules/ember-cli-dependency-checker/lib/package.js:4:13)
at EmberCLIDependencyChecker.<anonymous> (/home/folatt/workspace/arkos/genesis/node_modules/ember-cli-dependency-checker/lib/dependency-checker.js:126:12)
at Array.map (native)
at EmberCLIDependencyChecker.readDependencies (/home/folatt/workspace/arkos/genesis/node_modules/ember-cli-dependency-checker/lib/dependency-checker.js:122:36)
package.json
{
"author": "arkOS",
"description": "Web management frontend for arkOS servers",
"devDependencies": {
"broccoli-asset-rev": "^2.4.6",
"broccoli-funnel": "^1.0.6",
"ember-ajax": "^2.0.1",
"ember-cli": "^2.7.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-babel": "^5.1.6",
"ember-cli-content-security-policy": "^0.5.0",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-htmlbars": "^1.0.1",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-ic-ajax": "0.2.5",
"ember-cli-inject-live-reload": "^1.4.0",
"ember-cli-jshint": "^1.0.5",
"ember-cli-qunit": "^3.0.0",
"ember-cli-release": "^0.2.9",
"ember-cli-selectize": "^0.5.5",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-data": "^2.7.0",
"ember-export-application-global": "^1.0.4",
"ember-load-initializers": "^0.5.1",
"ember-resolver": "^2.1.0",
"ember-uploader": "^1.1.0",
"ember-welcome-page": "^1.0.3",
"loader.js": "^4.0.11"
},
"directories": {
"doc": "doc",
"test": "tests"
},
"ember-addon": {
"paths": [
"lib/basicsite",
"lib/jekyll",
"lib/owncloud",
"lib/radicale",
"lib/wallabag",
"lib/xmpp",
"lib/cmsjs",
"lib/duniter"
]
},
"engines": {
"node": ">= 0.10.0"
},
"license": "GPLv3",
"name": "genesis",
"private": true,
"repository": "",
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember test"
},
"version": "0.8.0"
}
bower.json
{
"name": "genesis",
"dependencies": {
"bootstrap": "^3.3.7",
"codemirror": "^5.18.2",
"ember": "^2.7.2",
"ember-cli-shims": "^0.1.3",
"ember-load-initializers": "^0.5.1",
"ember-qunit-builds": "^1.0.0-beta.1",
"ember-qunit-notifications": "^0.1.0",
"font-awesome": "^4.6.3",
"jquery": "^2.2.4",
"jQuery-contextMenu": "^2.2.4",
"lightbox2": "^2.8.2",
"loader.js": "^4.0.11",
"moment": "^2.14.1",
"mozilla-fira": "4.202",
"multiselect": "^0.9.12",
"qunit": "^2.0.1",
"selectize": "^0.12.3"
}
}
Results of bower install -force
http://pastebin.com/raw/zeiLdpAA
Try this solution
Setup
1- npm uninstall -g ember-cli -- Remove old global ember-cli
2- npm cache clean & bower cache clean-- Clear cache
3- npm install -g ember-cli#2.9.0-beta.1 -- Install new global ember-cli
Project Update
1- rm -rf node_modules bower_components dist tmp -- Delete temporary development folders.
2- npm install --save-dev ember-cli#2.9.0-beta.1 -- Update project's package.json to use latest version. [You can change #2.9... to #2.8.0 as well]
3- npm install & bower install-- Reinstall dependencies.
It worked for me, I hope it helps you.
I removed ember-cli-dependency-checker after discovering that it was 1 major version behind with ember.
Then I pruned (sudo npm prune) the project dependencies and tried ember build again.

При использовании команды sequalize db: migrate я получаю следующую ошибку. Глядя на некоторые из предыдущих комментариев по схожим проблемам, люди говорили, что это проблема зависимости, но всякий раз, когда я запускаю

npm установить mysql2

Или

npm install -g mysql2

Я получаю ту же ошибку.

larry@DESKTOP-NSSNPRR:/mnt/c/Users/larry/Desktop/node/AAF-NodeJS$
sequelize db:migrate

Sequelize CLI [Node: 10.1.0, CLI: 4.0.0, ORM: 4.37.10]

(node:2241) ExperimentalWarning: The fs.promises API is experimental
Loaded configuration file "db/config/database.json".
Using environment "development".

ERROR: Please install mysql2 package manually

Вот мой package.json, как некоторые из вас просили.

{
  "name": "aaf-website-node",
  "version": "0.0.1",
  "description": "Nodejs implementation of the achieve anything website",
  "main": "app.js",
  "scripts": {
    "start": "node bin/www",
    "dev": "node node_modules/nodemon/bin/nodemon.js bin/www",
    "test": "jasmine",
    "console": "node console.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/AchieveGirl/AAF-NodeJS.git"
  },
  "keywords": [
    "nodejs",
    "express"
  ],
  "author": "Larry Cherry",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/AchieveGirl/AAF-NodeJS/issues"
  },
  "homepage": "https://github.com/AchieveGirl/AAF-NodeJS/blob/master/README.md",
  "dependencies": {
    "body-parser": "^1.18.2",
    "bootstrap": "^4.0.0",
    "compression": "^1.7.2",
    "cookie-parser": "^1.4.3",
    "dotenv": "^5.0.1",
    "ejs": "^2.5.7",
    "eslint": "^4.19.1",
    "express": "^4.16.3",
    "express-ejs-layouts": "^2.3.1",
    "express-minify": "^1.0.0",
    "express-minify-html": "^0.12.0",
    "jquery": "^3.3.1",
    "lodash": "^4.17.5",
    "morgan": "^1.9.0",
    "mysql2": "^1.5.3",
    "node-fetch": "^2.1.2",
    "node-minify": "^2.4.1",
    "popper.js": "^1.14.3",
    "sequelize": "^4.37.10",
    "sequelize-cli": "^4.0.0",
    "serve-favicon": "^2.4.5",
    "webpack": "^4.1.1",
    "webpack-cli": "^2.0.12"
  },
  "devDependencies": {
    "nodemon": "^1.17.2",
    "pryjs": "^1.0.3"
  }
}

8 ответов

Лучший ответ

Вот и я наконец-то разобрался с ошибкой. Эта проблема возникает, когда вы вызываете миграцию из глобальной установки sequelize-cli вместо локальной версии sequelize в моем проекте. Все, что мне нужно было сделать, это вызвать скрипт из папки узлов модулей, и он работал отлично. Я вызывал команду таким образом sequelize db:migrate, когда мне нужно было вызвать локальный установленный пакет таким образом node_modules/.bin/sequelize db:migrate


10

Larry Cherry
7 Июн 2018 в 04:40

Причина, по которой вы получаете сообщение об ошибке с предложением установить модуль mysql2, заключается в том, что команда db:migrate полагается на mysql2, но как optionalDependencies, поэтому вы необходимо установить модуль mysql2 вручную


0

Felix Fong
30 Май 2018 в 23:51

  1. Список ваших глобальных пакетов npm

    npm list -g --depth 0

  2. Удалить sequelize

    npm uninstall -g sequelize

  3. Установить sequelize в области проекта

    npm install --save sequelize


0

BartusZak
23 Июл 2019 в 17:23

Мне не удалось вызвать конкретный экземпляр sequelize (локальный или глобальный), поэтому я удалил глобальный sequelize, который я добавил через пряжу yarn global remove sequelize, а затем добавил его локально в мой проект yarn add sequelize.

Эквивалентами npm будут npm -g uninstall sequelize и npm install sequelize.

Обратите внимание, что если кто-то проходит то же самое, у меня установлен mysql2.


0

Aurinxki
11 Окт 2019 в 13:47

Вы пытались сохранить файл config.json перед запуском sequelize db: migrate? В моем случае это был я


-2

Doug
4 Сен 2019 в 23:32

Начиная с версии 5.2.0, nodejs поставляется вместе с утилитой npx, которая предназначено для использования в качестве «обработчика пакетов», так как он сначала просматривает пакеты внутри ваших node_modules, у вас больше не должно быть проблем с выполнением команд с ним.

Теперь NPM следует использовать в качестве менеджера зависимостей вместо команды runner.

Вы можете проверить различия здесь


0

xiscode
14 Фев 2020 в 07:34

Я установил пакет mysql2 глобально из папки моего проекта, используя:

npm install mysql2 -g


3

TECT 2000
5 Сен 2019 в 16:08

Этот работал для меня

npm install mysql2 --save


5

bereket gebredingle
12 Сен 2018 в 15:49

Понравилась статья? Поделить с друзьями:
  • Error please define server type local and or tcp
  • Error please allow usb debugging security settings
  • Error playing video сити кар драйвинг
  • Error playing video city car driving что делать
  • Error playing video ccd