简体   繁体   English

npm如何知道从中安装模块的路径

[英]How does npm know the path to install module from

I am new to npm, using package.json to define the dependencies. 我是npm的新手,使用package.json定义依赖项。 I am just curious where is those dependencies installed from? 我很好奇这些依赖项是从哪里安装的?

First, npm checks your local machine for packages installed globally, or using the -g flag. 首先,npm检查本地计算机上是否有全局安装的软件包,或使用-g标志。

ie: if you used npm install -g moduleName 即:如果您使用npm install -g moduleName

You can run npm list -g to figure out where that is on your machine. 您可以运行npm list -g查明计算机上的位置。 Otherwise, npm goes to where you set the npm registry. 否则,npm会转到您设置npm注册表的位置。 By default this is npmjs . 默认情况下,这是npmjs

If you want to see the default settings, run npm config list 如果要查看默认设置,请运行npm config list

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

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