NPM安装错误(Package.JSON)不更新

在我的terminal,可以说我正在把npm install express mongoose bcrypt-nodejs morgan body-parser

我得到这个错误。

bson@0.2.19 install / Users / dan / nodeStuff / server-test / node_modules / mongoose / node_modules / mongodb / node_modules / bson(node-gyp rebuild 2> builderror.log) (出口0)

让我疯狂的是,我的node_modules在我的目录中得到更新,但没有更新的是package.json文件。 任何帮助将不胜感激。

试试 – 保存标志

 npm install express mongoose bcrypt-nodejs morgan body-parser --save 

默认情况下, npm install不会更新package.json。 你可以告诉它通过传递 – 保存, --save-exact ,等等:

$ npm install --save-exact express

详细信息在npm安装文档中 。

使用$npm init初始化package.json文件。 它以某种方式格式化该文件,npm可以更新。 不要自己更改此文件的格式,也不要使用Visual Studio等任何文本编辑器。 这样$npm install使用--save选项$npm install应该会更新package.json文件。