无法解析sequelize包

时间:2017-08-30 23:54:11

标签: node.js macos npm sequelize.js npm-install

我试图在我的Mac OS 10.12.6中安装sequelize-cli。

在终端,我做了

npm install -g sequelize-cli

我得到了

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
/usr/local/bin/sequelize -> /usr/local/lib/node_modules/sequelize-cli/bin/sequelize
/usr/local/lib
└── sequelize-cli@2.8.0 

然后,我试过

sequelize model:create --name User --attributes name:string,complete:boolean

我得到了

  

无法在/ Users / bheng / Sites / BASE

中解析sequelize包

我甚至尝试使用--save作为post建议。

npm install -g sequelize-cli --save

我得到了同样的结果。

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
/usr/local/bin/sequelize -> /usr/local/lib/node_modules/sequelize-cli/bin/sequelize
/usr/local/lib
└── sequelize-cli@2.8.0 

sequelize model:create --name User --attributes name:string,complete:boolean

  

无法在/ Users / bheng / Sites / BASE

中解析sequelize包

我还应该尝试什么?

4 个答案:

答案 0 :(得分:11)

在sequelize-cli package.json文件中,sequelize被称为devdependency,这意味着当你执行npm install sequelize-cli时它不会安装它。我的猜测是你没有自己安装sequelize,这就是错误所说的。

  

无法在/ Users / bheng / Sites / BASE

中解析sequelize包

安装sequelize npm install --save sequelize(或全局),事情应该是好的。

PS:Great answer关于不同的依赖关系及其含义

答案 1 :(得分:3)

我有同样的问题。我安装了sequelize-cli,却忘了自己添加sequelize

npm install sequelize

答案 2 :(得分:1)

您将需要全局安装sequelize。

npm install -g sequelize

答案 3 :(得分:1)

首先你需要安装 sequelize 包,然后执行 cli 命令。