Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix npm's global location?

Tags:

node.js

npm

When I run

npm ls -g

I get back

-> /usr/local/lib64/usr/local/bin (empty) 

Which is obviously incorrect. Using locate I can see my global modules are installed at /usr/lib64/node_modules. How do I go about correcting this issue? (I'm running gentoo amd64.)

like image 311
McLeopold Avatar asked Jul 13 '11 21:07

McLeopold


People also ask

Where is npm global located?

Path of Global Packages in the system: Global modules are installed in the standard system in root location in system directory /usr/local/lib/node_modules project directory. Command to print the location on your system where all the global modules are installed.


1 Answers

npm uses a .npmrc file which should be in your home directory. (ie ~/.npmrc) In this file you should see a key value pair with the key being "prefix". Try setting the value to something like "/usr/lib64". So your .npmrc file would have the following in addition to whatever else you put in it:

prefix = /usr/lib64 
like image 187
cmaxo Avatar answered Sep 24 '22 05:09

cmaxo