user33958
user33958

Reputation: 65

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:

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

Now, whenever i run an npm command i get the following error:

$ 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. I tried re-installing node/npm.

How do i reset the prefix? Thanks.

Upvotes: 0

Views: 3901

Answers (1)

user6335777
user6335777

Reputation:

If it is a permissions error, you should be able to use sudo to run it as root. This should take care of permission problems, which it appears to be in the error message

Upvotes: 1

Related Questions