Fail to install npm package "npm ERR! errno -4048"

I was having the same problem and I found the following solution:

  1. remove both of

    • %ProgramFiles%\nodejs\npm
    • %ProgramFiles%\nodejs\npm.cmd
  2. Go into %ProgramFiles%\nodejs\node_modules\npm and copy the file named npmrc in the new npm folder, which should be %appdata%\npm\node_modules\npm. This will tell the new npm where the global installed packages are.

  3. Restart Windows and it worked.

Found this over here (the npm troubleshooting section). Credits to the authors there


Kill whatever process is locking your files

It seems like this kind of error can be caused by a file permissions lock - I experienced something very similar (the same ERRNO: -4048) when installing whatwg-fetch.

I found that a Visual Studio instance I had open at the same time was acquiring all kinds of files which it didn't need. Once I closed that down, the install worked perfectly.

This may be a quickly-checked possible cause to eliminate before moving on to more drastic measures...


if you still have troubles with this error and maybe you upgrade the node version to 5.4 > ... that version presents an error. here the solution that basically consist in downgrade node version

In Windows will be:

npm install -g [email protected]

That's works for me.