简体   繁体   English

是否使用“npm install -g my-package”安装了 devDependencies?

[英]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.

相关问题 Node / npm:如何管理全局安装的devDependencies - Node / npm: How to manage globally installed devDependencies npm/yarn 默认安装 devDependencies 吗? - Does npm/yarn install devDependencies by default? 为什么“ npm安装 <directory> 忽略devDependencies? - Why does “npm install <directory>” ignore devDependencies? 使用devDependencies部署NPM包时,何时进行构建? - When does a build happen when you deploy a NPM package with devDependencies? 如何仅在节点8.7.x上npm安装devDependencies? - how to npm install only devDependencies with node 8.7.x? npm install vs sudo npm install -g - npm install vs sudo npm install -g 为什么我的npm package的所有文件都安装在node_modules中? - Why all files of my npm package are installed in node_modules? 错误:加载 firebase.json 时出错:未安装 Bolt,运行 npm install -g firebase-bolt - Error: There was an error loading firebase.json: Bolt not installed, run npm install -g firebase-bolt 'npm 是否安装'l<package_name> 安装一个package的最新版本还是安装最新版本的node兼容?</package_name> - Does 'npm instal'l <package_name> install the latest version of a package or the latest compatible with the version of node installed? npm install handlebars -g错误 - npm install handlebars -g ERRORS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM