简体   繁体   中英

Where npm install the packages?

I have some mess with npm. I'm trying to update npm and other libs with npm but it doesn't update, I tried some solutions but they haven't worked for me.

The following shows the pathnames returned when running; npm root , npm root -g , and which npm via the command-line:

 $ npm root /Users/MYUSER/node_modules $ npm root -g /usr/local/Cellar/node/13.7.0/lib/node_modules $ which npm /usr/local/bin/npm

Can you help me understand what is wrong here?

I can understand your confusion. First of all, what is important to know, is that Node is the Software that is running your code. NPM is a package manager, which ships together when installing Node.

As different projects require their specific Node Version, I like using NVM - the Node Version Manager.

The node_modules Directory in your Home Folder exists because you probably have executed the npm install command inside your Home folder. It has created the node_modules Directory and downloaded the packages in there. It is a good practice to keep your HOME Directory as clean as possible, and there is no reason to keep the node_modules Folder there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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