I have installed the global npm package jslint
and it lives here
$ ls -la /usr/local/bin/jslint lrwxr-xr-x 1 lust admin 40 Feb 12 15:31 /usr/local/bin/jslint -> ../lib/node_modules/jslint/bin/jslint.js $ ls -la /usr/local/lib/node_modules/jslint/bin total 8 drwxr-xr-x 3 lust staff 102 Apr 16 2012 . drwxr-xr-x 10 lust staff 340 Feb 12 15:31 .. -rwxr-xr-x 1 lust staff 2330 Apr 16 2012 jslint.js $ which jslint /usr/local/bin/jslint $ head -3 /usr/local/bin/jslint #!/usr/bin/env node var linter = require("../lib/linter");
So it is without any doubt whatsoever at this point that jslint
is in fact being run from this dir and not here:
$ ls -la .npm/jslint/0.1.9/package/bin/ total 8 drwxr-xr-x 3 lust staff 102 Apr 16 2012 . drwxr-xr-x 9 lust staff 306 Feb 12 15:31 .. -rwxr-xr-x 1 lust staff 2330 Apr 16 2012 jslint.js
There appear to be two copies of the package, one in /usr/local/
and one in ~/.npm
. Why is there one in .npm
and is it safe for me to remove it?
The command npm root will tell you the effective installation directory of your npm packages. If your current working directory is a node package or a sub-directory of a node package, npm root will tell you the local installation directory.
NPM installs global packages into /<User>/local/lib/node_modules folder. Apply -g in the install command to install package globally.
npm is the world's largest Software Registry. The registry contains over 800,000 code packages. Open-source developers use npm to share software. Many organizations also use npm to manage private development.
On most systems, this is /usr/local . On Windows, it's %AppData%\npm . On Unix systems, it's one level up, since node is typically installed at {prefix}/bin/node rather than {prefix}/node.exe .
~/.npm
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With