McLeopold
McLeopold

Reputation: 6147

How do I fix npm's global location?

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.)

Upvotes: 34

Views: 23229

Answers (3)

Bob Z
Bob Z

Reputation: 1

My default is ${APPDATA}/npm.

Upvotes: 0

Jason Lewis
Jason Lewis

Reputation: 18665

For those on Windows the npmrc file can be found in C:\path\to\nodejs\node_modules\npm\npmrc. You can change the prefix as mentioned in the answer by cmaxo. By default it's usually something like ${APPDATA}\npm.

Upvotes: 19

cmaxo
cmaxo

Reputation: 371

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

Upvotes: 24

Related Questions