Wednesday, January 8, 2014

npm package folder on mac

The npm package may be installed on the following folders on mac
1.  ./node_modules
If the package is installed locally, the folder is in the current folder's ./node_modules of the current package. You should install the package locally, if the package will be loaded into your js app with require() method.

2.    /usr/local/lib/node_modules folder
If the package is installed globally, i.e, installed with -g flag, then it is installed in
 /usr/local/lib/node_modules folder

3. ~/.npm 
There will be another copy in your home directory's ~/.npm folder, it is a cache that npm uses to avoid re-downloading the same package multiple times. There's no harm in removing it. You can empty it with the command:
npm cache clean


To uninstall a local npm package, use
npm rm

to uninstall a global npm package, use
npm rm -g

To check an installed npm package version, use
npm view packagename

No comments:

Post a Comment