简体   繁体   English

如何在npm中同步包json的依赖关系

[英]How to sync the dependency of package json in npm

In my case,i use npm install moduleName -save to install a module ,but after npm notice that it is install complete,the package.json will not be add dependencies of the module; 在我的例子中,我使用npm install moduleName -save来安装模块,但是在npm之后注意到它是安装完成的,package.json将不会添加模块的依赖项; Is there any solution to sync from module to dependencies; 是否有任何解决方案可以从模块同步到依赖项; Thanks at first 首先谢谢

你需要npm install moduleName --save (2' - ')

Actually you can use one -s. 实际上你可以使用一个-s。 Here is the quote from the npm documentation: 以下是npm文档的引用:

As of version 2.0.0 you can provide a path to a local directory that contains a package. 从版本2.0.0开始,您可以提供包含包的本地目录的路径。 Local paths can be saved using npm install -S or npm install --save , using any of these forms: 可以使用以下任何形式使用npm install -Snpm install --save保存本地路径:

So if you wanted to install lodash you could use: 所以如果你想安装lodash你可以使用:

npm install lodash --save

or: 要么:

npm install -S lodash

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

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