如何修复 npm 的全局位置? [英] How do I fix npm's global location?

查看:86
本文介绍了如何修复 npm 的全局位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我跑步时

npm ls -g

我回来了

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

这显然是不正确的.使用 locate 我可以看到我的全局模块安装在 /usr/lib64/node_modules.我该如何解决这个问题?(我正在运行 gentoo amd64.)

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

推荐答案

npm 使用 .npmrc 文件,该文件应位于您的主目录中.(ie ~/.npmrc) 在这个文件中,你应该看到一个键值对,键是前缀".尝试将该值设置为/usr/lib64"之类的值.因此,除了您放入的其他内容之外,您的 .npmrc 文件还将包含以下内容:

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

这篇关于如何修复 npm 的全局位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆