Runnin from the console
> npm root -g
Or programmatically
var npm = require("npm");
npm.load(null, function (err, npm) {
npm.config.set("global", true);
npm.root;
});
I get a different results on Windows. The first one returns C:\Users\myuser\AppData\Roaming\npm\node_modules
and the second one C:\Program Files (x86)\nodejs\node_modules
. The same happens when I install a module, doing this programmatically tries to install it on program files instead of AppData.
Could this be a bug? Or am I doing something wrong?
On linux it works consistently. I've not tried on Mac.
Update: I tried this on Mac and it works fine.