简体   繁体   English

npm install with --save 不会保存在 package.json 中

[英]npm install with --save does not save in package.json

I have npm-5.3.0 installed on my arch Linux.我在我的 arch Linux 上安装了npm-5.3.0

I create a new project with npm init and fill in the details.我使用npm init创建一个新项目并填写详细信息。 This creates a package.json file with the details.这将创建一个包含详细信息的 package.json 文件。

After that when I do npm install <package> --save , the file package.json does not change, and there is no entry for dependencies in the file.之后,当我执行npm install <package> --save时,文件package.json不会更改,并且文件中没有依赖项条目。 I had installed the package globally previously if that matters.如果重要的话,我之前已经在全球范围内安装了这个包。

I found that the --save does not work with global and I had global=true set in the .npmrc file.我发现--save不适用于 global 并且我在.npmrc文件中设置了global=true

Setting global=false in the file fixed it.在文件中设置global=false修复了它。

Check update is available npm i -g npm-check-updates npm-check-updates -u npm install检查更新是否可用 npm i -g npm-check-updates npm-check-updates -u npm install

you have to change你必须改变

"dependencies": { "express": " ", "mongodb": " ", "underscore": " ", "rjs": " ", "jade": " ", "async": " " } "dependencies": { "express": " ", "mongodb": " ", "underscore": " ", "rjs": " ", "jade": " ", "async": " " }

then run npm update --save然后运行 npm update --save

ı have solved adding npm 'FIRST' module from to dependencies manuelly in package.js this problem.我已经解决了在 package.js 中手动添加 npm 'FIRST' 模块到依赖项这个问题。 Next, you can try npm install moduleName --save接下来,您可以尝试 npm install moduleName --save

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM