简体   繁体   English

npm:如何重置node_modules前缀

[英]npm: How to reset the node_modules prefix

i installed node via homebrew. 我通过自制软件安装了节点。 Since i had problems accessing the packages, i tried to change the node_modules prefix to user/local but made an error while typing the command: 由于我在访问软件包时遇到问题,因此我尝试将node_modules前缀更改为user/local但是在键入命令时出错:

npm config set prefix /usr/l    # See the typo there
                            ^

Now, whenever i run an npm command i get the following error: 现在,每当我运行npm命令时,都会出现以下错误:

$ npm config ls -l
Error: EACCES: permission denied, mkdir '/usr/l'
at Error (native)

i cannot set the prefix again ( npm config set prefix /usr/local ) , or even list the config ( npm config ls -l ) – all produce the same error as above. 我无法再次npm config set prefix /usr/localnpm config set prefix /usr/local ),甚至无法列出配置( npm config ls -l )–都产生与上述相同的错误。 I tried re-installing node/npm. 我尝试重新安装node / npm。

How do i reset the prefix? 如何重置前缀? Thanks. 谢谢。

If it is a permissions error, you should be able to use sudo to run it as root. 如果是权限错误,则应该可以使用sudo以root身份运行它。 This should take care of permission problems, which it appears to be in the error message 这应该解决权限问题,该问题似乎在错误消息中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM