node.jsnpmnode-xmpp

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


I'm trying to install an npm package (node-xmpp-server) but it fails to install. Previously when I'm trying to install a package that is install globally instead of locally, but now it's not installing at all. I'm running bash as administrator.

I ran:

npm install node-xmpp-server

The error is:

npm ERR! errno -4048
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program
Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-xmpp-server"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! path c:\Users\Jaseem Abbas\Documents\node_modules\node- xmpp-server\examples
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, unlink 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM, unlink 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples']
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   path: 'c:\\Users\\Jaseem Abbas\\Documents\\node_modules\\node-xmpp-server\\examples' } npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EPERM, unlink 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples'
npm ERR! error rolling back     at Error (native)
npm ERR! error rolling back  { [Error: EPERM, unlink 'c:\Users\Jaseem
Abbas\Documents\node_modules\node-xmpp-server\examples']
npm ERR! error rolling back   errno: -4048,
npm ERR! error rolling back   code: 'EPERM',
npm ERR! error rolling back   path: 'c:\\Users\\Jaseem Abbas\\Documents\\node_modules\\node-xmpp-server\\examples' }

Solution

  • 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...