4

I have Node.js installed and I have ran npm install -g grunt-cli I have cd to the directory of the app I am to work on and followed the instructions here. When I run grunt in my cmd it returns

module.js:340
    throw err;
          ^

Error: Cannot find module '\\Server\username$\Redirected\AppData\npm\AppData\npm\node_modules\grunt-cli'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

I really am not sure why its trying to read from \AppData\npm\AppData\npm\ as I haven't made any changes and I don't know how to change the grunt location

But when I use npm install -g grunt-cli it downloads and installs to the following \\Server\username$\Redirected\AppData\npm\node_modules\grunt-cli

Community
  • 1
  • 1
ngplayground
  • 20,365
  • 36
  • 94
  • 173
  • 3
    It looks like maybe it is getting confused on the UNC path for your profile. NPM packages are installed in your local %USERPROFILE%\AppData\npm – nschonni Oct 03 '13 at 14:59
  • @nschonni how can I change it to leave the UNC path and goto say `C:\\Users\username` ? – ngplayground Oct 04 '13 at 08:34

1 Answers1

0

You need to change the global install directory.

Try this ..

In C:\Users{username}\, create .npmrc file with contents:

prefix = "C:\\Users\\{username}\\AppData\\Roaming\\npm"

This is discussed more fully here:

Change default global installation directory for node.js modules in Windows?

Community
  • 1
  • 1
danday74
  • 52,471
  • 49
  • 232
  • 283