If npm tries to install into C:\Program Files

After some uprade (VS 2015 update 3 install?) npm started to install packages into C:\Program Files\nodejs\node_modules, thus requirement admin rights and generally wrecking havoc. Previous installation location was
%appdata%/npm/node_modules.

Npm people claim that this should never happen, while other people claim this happens like all the time. Long story short, this can be overridden by placing an .npmrc file in your home folder (C:\users\{username}) that says

prefix=C:\Users\{user_name_here}\AppData\Roaming\npm

Chances are your package store became corrupted (mine did), so run npm update after you change the prefix.

Leave a Reply

Your email address will not be published. Required fields are marked *