Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm install gives error -4048 #19956

Open
1 of 4 tasks
kevinkuszyk opened this issue Mar 2, 2018 · 4 comments
Open
1 of 4 tasks

npm install gives error -4048 #19956

kevinkuszyk opened this issue Mar 2, 2018 · 4 comments

Comments

@kevinkuszyk
Copy link

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

We get intermittent error -4048 when we run npm install on our build server. This is the console output:

NPM Install (Command Line) (1m:01s)
Starting: E:\Teamcity\buildAgent_9073\temp\agentTmp\custom_script3908882039329034135.cmd
in directory: E:\Teamcity\buildAgent_9073\work\96175c75bacff52c
npm ERR! path E:\Teamcity\buildAgent_9073\work\96175c75bacff52c\node_modules\requirejs\bin\r.js.3647493671
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'E:\Teamcity\buildAgent_9073\work\96175c75bacff52c\node_modules\requirejs\bin\r.js.3647493671' -> 'E:\Teamcity\buildAgent_9073\work\96175c75bacff52c\node_modules\requirejs\bin\r.js'
npm ERR!  { Error: EPERM: operation not permitted, rename 'E:\Teamcity\buildAgent_9073\work\96175c75bacff52c\node_modules\requirejs\bin\r.js.3647493671' -> 'E:\Teamcity\buildAgent_9073\work\96175c75bacff52c\node_modules\requirejs\bin\r.js'
npm ERR!   cause: 
npm ERR!    { Error: EPERM: operation not permitted, rename 'E:\Teamcity\buildAgent_9073\work\96175c75bacff52c\node_modules\requirejs\bin\r.js.3647493671' -> 'E:\Teamcity\buildAgent_9073\work\96175c75bacff52c\node_modules\requirejs\bin\r.js'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'rename',
npm ERR!      path: 'E:\\Teamcity\\buildAgent_9073\\work\\96175c75bacff52c\\node_modules\\requirejs\\bin\\r.js.3647493671',
npm ERR!      dest: 'E:\\Teamcity\\buildAgent_9073\\work\\96175c75bacff52c\\node_modules\\requirejs\\bin\\r.js' },
npm ERR!   stack: 'Error: EPERM: operation not permitted, rename \'E:\\Teamcity\\buildAgent_9073\\work\\96175c75bacff52c\\node_modules\\requirejs\\bin\\r.js.3647493671\' -> \'E:\\Teamcity\\buildAgent_9073\\work\\96175c75bacff52c\\node_modules\\requirejs\\bin\\r.js\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'E:\\Teamcity\\buildAgent_9073\\work\\96175c75bacff52c\\node_modules\\requirejs\\bin\\r.js.3647493671',
npm ERR!   dest: 'E:\\Teamcity\\buildAgent_9073\\work\\96175c75bacff52c\\node_modules\\requirejs\\bin\\r.js',
npm ERR!   parent: 'iviewplus.external.web' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\*****\AppData\Roaming\npm-cache\_logs\2018-03-02T11_47_49_226Z-debug.log
Process exited with code -4048
Process exited with code -4048
Step NPM Install (Command Line) failed

I've looked at issues #17671, #18441 and #18380. Although they're all closed, we still see this issue.

We don't see this on every build. Each build runs in a new clean folder. We've tried cleaning the cache etc to no avail. Despite the error message, the build agent runs as a local admin.

I've been unable to repro it on my Windows 10 laptop.

supporting information:

  • npm -v prints: 5.6.0
  • node -v prints: 9.2.0
  • npm config get registry prints:
  • Windows, OS X/macOS, or Linux?: Windows Server 2012 R2
  • Network issues:
    • Geographic location where npm was run: UK
@zkat
Copy link
Contributor

zkat commented Mar 2, 2018

@kevinkuszyk as a workaround -- can you try using npm@5.7.1's npm ci command? It installs differently than npm itself, and it doesn't involve the whole renaming thing. It's meant to be used in CI, anyway.

We'll still try and track down what's causing npm itself to do this, since we've already got things in place that are supposed to protect against Windows file-grabbing weirdness.

@kevinkuszyk
Copy link
Author

kevinkuszyk commented Mar 5, 2018

Thanks @zkat, I'll give that a try and let you know how we get on.

@kevinkuszyk
Copy link
Author

@zkat so far so good with the npm ci. After running it for a week we haven't had any more error -4048's.

@Neonit
Copy link

Neonit commented May 4, 2018

Encountered the same error, also with requirejs/r.js, also running npm 5.6.0 (but using Node 10.0.0). I managed to solve the issue following a tip from a user in a react community issue.

Basically they disabled antivirus (I did that, too; don't know, if it is required, though) and verified the cache (npm cache verify). Disabling antivirus, then just retrying npm i (as suggested earlier in the linked thread) did not work out for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants