简体   繁体   English

npm:“--save”-flag 必须将依赖项写入“package.json”?

[英]npm: “--save”-flag necessary to write dependencies to “package.json”?

Is the "--save"-flag really necessary to write an installed dependency to the "package.json"-file.将安装的依赖项写入“package.json”文件是否真的需要“--save”标志。

I have tried it out without the "save"-flag and the package was afterward nevertheless within the "dependencies"-section.我已经在没有“保存”标志的情况下进行了尝试,然后 package 仍然在“依赖项”部分中。 So the adding seem to be default-behaviour.所以添加似乎是默认行为。

So, therefore my question: What benefit provides the standard "save"?因此,我的问题是:提供标准“保存”的好处是什么? Or can one leave it as well ?或者也可以离开它

Not the "save-dev".不是“保存开发”。 That's clear to me.这对我来说很清楚。

As of npm 5.0.0 , installed modules are added as a dependency by default, so the --save option is no longer needed.npm 5.0.0 开始,已安装的模块默认添加为依赖项,因此不再需要--save选项。 The other save options still exist and are listed in the documentation for npm install .其他保存选项仍然存在,并列在npm install文档中。

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

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