[英]Are devDependencies installed with `npm install -g my-package`?
I read this thread , but I'm not sure to understand the answers, and it seems it does not answer this particular case.我读了这个帖子,但我不确定是否理解答案,而且它似乎没有回答这个特殊情况。 So I prefer to ask this as a specific question:
所以我更愿意把这个作为一个具体的问题来问:
Are devDependencies
installed with npm install -g my-package
? devDependencies
是否安装了npm install -g my-package
?
No devDependencies are not included when you are installing a package (whether it's your own package or other packages).安装 package(无论是您自己的 package 还是其他软件包)时,不包含任何devDependencies 。
Development dependencies are meant only for local development purpose which contains testing framework, documentation libraries and other, which is not required for the consumers who intended to consume /install/ use the packages.开发依赖项仅用于本地开发目的,其中包含测试框架、文档库和其他,对于打算使用/安装/使用包的消费者来说不是必需的。
So whenever you install a package using npm -i <package-name>
or npm -i -g <package-name>
it only installs the dependencies not devDependencies.因此,每当您使用
npm -i <package-name>
或npm -i -g <package-name>
安装 package 时,它只会安装依赖项而不是 devDependencies。 Check out this npm documentation for more info查看此npm 文档了解更多信息
If my-package
is a npm package that exist in npm registry - it will be installed globally without devDependencies.如果
my-package
是 npm 注册表中存在的 npm package 注册表 - 它将在没有 devDependencies 的情况下全局安装。
The only difference -g
makes in this situation is my-package
would be installed globally in the machine instead of to local node_modules
folder. -g
在这种情况下的唯一区别是my-package
将全局安装在机器中而不是本地node_modules
文件夹中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.