Description
What / Why
We recently upgraded from npm 6.0.1 to 6.12.0 and several of our engineers are encountering persistent EPERM
issues when they run npm install
.
From all angles the folders in question have the right permissions set, and we've ruled out nvm
as a possible reason for this failure too. No combination of uninstalling and reinstalling or cache clearing has resolved it.
Whenever they run npm install
, they get output like this:
code EPERM
npm ERR! syscall spawn
npm ERR! errno EPERM
npm ERR! Error: spawn EPERM
npm ERR! at ChildProcess.spawn (internal/child_process.js:394:11)
npm ERR! at Object.spawn (child_process.js:540:9)
npm ERR! at /Users/REDACTED/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24
npm ERR! at /Users/REDACTED/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24
npm ERR! OperationalError: spawn EPERM
npm ERR! at ChildProcess.spawn (internal/child_process.js:394:11)
npm ERR! at Object.spawn (child_process.js:540:9)
npm ERR! at /Users/REDACTED/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24
npm ERR! at /Users/REDACTED/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24 {
npm ERR! cause: Error: spawn EPERM
npm ERR! at ChildProcess.spawn (internal/child_process.js:394:11)
npm ERR! at Object.spawn (child_process.js:540:9)
npm ERR! at /Users/REDACTED/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24
npm ERR! at /Users/REDACTED/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24 {
npm ERR! errno: 'EPERM',
npm ERR! code: 'EPERM',
npm ERR! syscall: 'spawn'
npm ERR! },
npm ERR! stack: 'Error: spawn EPERM\n' +
npm ERR! ' at ChildProcess.spawn (internal/child_process.js:394:11)\n' +
npm ERR! ' at Object.spawn (child_process.js:540:9)\n' +
npm ERR! ' at /Users/REDACTED/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24\n' +
npm ERR! ' at /Users/REDACTED/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24',
npm ERR! errno: 'EPERM',
npm ERR! code: 'EPERM',
npm ERR! syscall: 'spawn',
npm ERR! parent: 'webapp'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/REDACTED/.npm/_logs/2019-11-12T21_45_00_580Z-debug.log
I walked back the version of npm until 6.10.3, where installs work again. The mention of pacote
in the above logs seems suspicious when you compare it to the release notes for 6.11.0:
dc8f9e5 pacote@9.5.7: Infer the ownership of all unpacked files in node_modules, so that we never have user-owned files in root-owned folders, or root-owned files in user-owned folders. (@isaacs)
Note that upgrading to 6.13.0 does not fix the problem.
Also note that we have some private git+ssh urls in our package.json
Where
npm public registry
How
Current Behavior
Install fails with above error output, EPERM
Steps to Reproduce
npm i -g npm@6.11.0 && npm install
Expected Behavior
Install works as before