简体   繁体   English

节点 npm 本地安装覆盖全局安装

[英]node npm local install override global install

如果我在本地安装了节点模块(与我的节点应用程序在同一文件夹中),它们是否会覆盖相同模块的全局安装?

Yes.是的。 See the documentationhere on module resolution.请参阅此处有关模块分辨率的文档。 And, just to be clear, "override" here simply means that the local module is the one that will be resolved to.而且,要清楚的是,这里的“覆盖”仅意味着本地模块是将被解析的模块。 The global module will be left untouched, and node.js apps in other directories will still be able to use the global module. global 模块将保持不变,其他目录中的 node.js 应用程序仍然可以使用 global 模块。


Edit: it would probably also help to better understand how the global installs with npm work. 编辑:它可能也有助于更好地了解 npm 的全局安装如何工作。 More info on that is [here](https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/). 更多信息在[这里](https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/)。

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

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