Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...