sequelize.js - 您需要手动安装 mysql 包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17667368/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
sequelize.js - You need to install mysql package manually
提问by thaspius
After installing node.js and sequelize.js, and running a basic test, the message "You need to install mysql package manually" is displayed.
安装好node.js和sequelize.js,运行基本测试后,提示“您需要手动安装mysql包”。
I've tried searching the web and Stackoverflow for the cause of this message.
我已经尝试在网络和 Stackoverflow 上搜索此消息的原因。
I have installed:
我已经安装:
- mysql server version 5.5.31-0ubuntu0.13.04.1
- node v0.10.5
- sequelize.js v1.6.0
- mysql 服务器版本 5.5.31-0ubuntu0.13.04.1
- 节点 v0.10.5
- sequelize.js v1.6.0
回答by go-oleg
You need to install the mysql
npm module:
您需要安装mysql
npm 模块:
npm install mysql
npm install mysql
The reason sequelize doesn't have the mysql module as its own dependency is because it can be used with other databases such as postgres or sqlite.
sequelize 没有 mysql 模块作为它自己的依赖项的原因是因为它可以与其他数据库一起使用,例如 postgres 或 sqlite。
回答by Svagis
Install mysql globally:
全局安装mysql:
npm install -g mysql
回答by James Gentes
For 2017+ users who are using mysql2
, the mysql
requirement was part of Sequelize v3.
对于使用 2017+ 的用户mysql2
,该mysql
要求是 Sequelize v3 的一部分。
Install v4 of Sequelize (ie. npm i [email protected] --save
) and it will work properly with mysql2
.
安装 Sequelize 的 v4(即npm i [email protected] --save
),它将与mysql2
.
For more info, see this issue in the github repo.
有关更多信息,请参阅github repo 中的此问题。
回答by ramachandrareddy reddam
// Using NPM
$ npm install --save sequelize
# And one of the following:
$ npm install --save pg pg-hstore
$ npm install --save mysql2
$ npm install --save sqlite3
$ npm install --save tedious // MSSQL
回答by codeshinobi
I had tried 'npm install mysql' as it is a few times (OCD maybe), but it didn't do the trick. What actually made a difference was the answer by Svagis above:
我试过'npm install mysql',因为它有几次(可能是强迫症),但它没有成功。实际上有所不同的是上面 Svagis 的回答:
npm install -g mysql
Now I get an access denied error, which is more of a relief because it means progress.
现在我收到一个访问被拒绝的错误,这更像是一种解脱,因为它意味着进步。
回答by Jimmy Wong
As a good practice, it is suggested to keep these library local to the project, so that it can be packaged and installed in other machines by npm.
作为一个好习惯,建议将这些库保存在项目本地,以便通过 npm 打包安装到其他机器上。
回答by Bahroel0
i try to install package mysql and mysql2. It works!
我尝试安装包 mysql 和 mysql2。有用!
npm install mysql2 --save
npm install mysql2 --save