Node.js and installing Grunt on Windows

I have Node.js installed, and I started npm install -g grunt-cli. I have an cdapplication in the directory that I have to work on, and follow the instructions. When I run gruntin 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 don’t know why I am trying to read it from \AppData\npm\AppData\npm\, since I have not made any changes, and I do not know how to change the location of grunt

But when I use npm install -g grunt-cli, it loads and installs on the next\\Server\username$\Redirected\AppData\npm\node_modules\grunt-cli

+4
source share
1 answer

You need to change the global installation directory.

Try it.

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

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

:

node.js Windows?

0

All Articles