Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the npm prefix without config?

Tags:

node.js

npm

I accidentally changed the npm prefix to a place that doesn't exist. Is there a configuration file I can access that would allow me to change this back?

The only options I can think of are:

  1. Completely Uninstall Node (npm not responding after changing the prefix)
  2. I guess I could create the directories that don't exist and move the npm files there.

But it seems like there should be a config file I can change somewhere, right?

like image 581
Travis Heeter Avatar asked Oct 21 '16 13:10

Travis Heeter


1 Answers

prefix can be defined per-install and other commands using --prefix, but as a global setting it is in ~/.npmrc (C:\Users\<your user name>\.npmrc). You can remove / edit it directly in that file.

You can also use npm config set prefix $value, or npm config delete prefix if you prefer.

like image 168
Explosion Pills Avatar answered Sep 28 '22 11:09

Explosion Pills