npm 6.11.X breaks `npm ci` with EPERM error for private github package

What I Wanted to Do

Our automatic build runs npm ci to refresh any packages that were added or changed in a commit.

What Happened Instead

After upgrading npm from 6.10.3 to 6.11.X (tried 6.11.0, 6.11.1, and 6.11.2), running npm ci breaks on installation of a package from a git repository (github:someuser/somepackage package) with EPERM on a spawn call. Downgrading to 6.10.3 fixes the issue.

npm install works fine.

The command broke with an EPERM error:

npm ERR! code EPERM
npm ERR! syscall spawn
npm ERR! errno EPERM
npm ERR! Error: spawn EPERM
npm ERR!     at ChildProcess.spawn (internal/child_process.js:358:11)
npm ERR!     at Object.spawn (child_process.js:533:9)
npm ERR!     at promiseRetry (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24)
npm ERR!     at /usr/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24
npm ERR!  { Error: spawn EPERM
npm ERR!     at ChildProcess.spawn (internal/child_process.js:358:11)
npm ERR!     at Object.spawn (child_process.js:533:9)
npm ERR!     at promiseRetry (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24)
npm ERR!     at /usr/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24
npm ERR!   cause:
npm ERR!    { Error: spawn EPERM
npm ERR!        at ChildProcess.spawn (internal/child_process.js:358:11)
npm ERR!        at Object.spawn (child_process.js:533:9)
npm ERR!        at promiseRetry (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24)
npm ERR!        at /usr/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24 errno: 'EPERM', code: 'EPERM', syscall: 'spawn' },
npm ERR!   isOperational: true,
npm ERR!   stack:
npm ERR!    'Error: spawn EPERM\n    at ChildProcess.spawn (internal/child_process.js:358:11)\n    at Object.spawn (child_process.js:533:9)\n    at promiseRetry (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24)\n    at /usr/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24',
npm ERR!   errno: 'EPERM',
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'spawn' }

Reproduction Steps

I’m so far unable to create a reproducible version outside of our current build environments. Paring the package.json down to the single private dependency still fails, however.

Details

  • Clearing node_modules does not help.
  • Clearing the cache does not help.
  • Backing pacote off to the previously installed version 9.5.4 does not help.
  • Removing package-lock.json and regenerating it with npm install does not help, as removing * package-lock.json causes npm install to fail with the EPERM error.

The relevant package.json line looks like this:

”somepackage": "github:someuser/somepackage#v6.6.6"

where the repository is private.

npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'ci' ]
2 info using npm@6.11.2
3 info using node@v10.14.0
4 info prepare initializing installer
5 verbose prepare starting workers
6 verbose prepare installation prefix: /srv/sp/web
7 verbose prepare using package-lock.json
8 warn prepare removing existing node_modules/ before installation
9 verbose checkLock verifying package-lock data
10 silly tree LogicalTree {
10 silly tree   name: 'some-name',
10 silly tree   version: '1.0.0',
10 silly tree   address: '',
10 silly tree   optional: false,
10 silly tree   dev: false,
10 silly tree   bundled: false,
10 silly tree   resolved: undefined,
10 silly tree   integrity: undefined,
10 silly tree   dependencies:
10 silly tree    Map {
10 silly tree      'somerepo' => LogicalTree {
10 silly tree        name: 'somerepo',
10 silly tree        version:
10 silly tree         'github:somegithubuser/somerepo#e08e5b6270a943d1f9b3a501ddd0a780b40d477f',
10 silly tree        address: 'somerepo',
10 silly tree        optional: false,
10 silly tree        dev: false,
10 silly tree        bundled: false,
10 silly tree        resolved: undefined,
10 silly tree        integrity: undefined,
10 silly tree        dependencies: [Map],
10 silly tree        requiredBy: [Set] } },
10 silly tree   requiredBy: Set {} }
11 info prepare Done in 0.198s
12 verbose extractTree extracting dependencies to node_modules/
13 silly extractTree somerepo@github:somegithubuser/somerepo#e08e5b6270a943d1f9b3a501ddd0a780b40d477f -> /srv/sp/web/node_modules/somerepo
14 silly tarball no local data for somerepo@github:somegithubuser/somerepo#e08e5b6270a943d1f9b3a501ddd0a780b40d477f. Extracting by manifest.
15 verbose teardown shutting down workers.
16 info teardown Done in 0s
17 verbose stack Error: spawn EPERM
17 verbose stack     at ChildProcess.spawn (internal/child_process.js:358:11)
17 verbose stack     at Object.spawn (child_process.js:533:9)
17 verbose stack     at promiseRetry (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24)
17 verbose stack     at /usr/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24
18 verbose cwd /srv/sp/web
19 verbose Linux 3.13.0-170-generic
20 verbose argv "/usr/bin/node" "/usr/bin/npm" "ci"
21 verbose node v10.14.0
22 verbose npm  v6.11.2
23 error code EPERM
24 error syscall spawn
25 error errno EPERM
26 error Error: spawn EPERM
26 error     at ChildProcess.spawn (internal/child_process.js:358:11)
26 error     at Object.spawn (child_process.js:533:9)
26 error     at promiseRetry (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24)
26 error     at /usr/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24
26 error  { Error: spawn EPERM
26 error     at ChildProcess.spawn (internal/child_process.js:358:11)
26 error     at Object.spawn (child_process.js:533:9)
26 error     at promiseRetry (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24)
26 error     at /usr/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24
26 error   cause:
26 error    { Error: spawn EPERM
26 error        at ChildProcess.spawn (internal/child_process.js:358:11)
26 error        at Object.spawn (child_process.js:533:9)
26 error        at promiseRetry (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24)
26 error        at /usr/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24 errno: 'EPERM', code: 'EPERM', syscall: 'spawn' },
26 error   isOperational: true,
26 error   stack:
26 error    'Error: spawn EPERM\n    at ChildProcess.spawn (internal/child_process.js:358:11)\n    at Object.spawn (child_process.js:533:9)\n    at promiseRetry (/usr/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:216:24)\n    at /usr/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24',
26 error   errno: 'EPERM',
26 error   code: 'EPERM',
26 error   syscall: 'spawn' }
27 error The operation was rejected by your operating system.
27 error It is likely you do not have the permissions to access this file as the current user
27 error
27 error If you believe this might be a permissions issue, please double-check the
27 error permissions of the file and its containing directories, or try running
27 error the command again as root/Administrator.
28 verbose exit [ 1, true ]

Platform Info

$ npm --versions
{ ‘some-name’: '1.0.0',
  npm: '6.11.2',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.14.0',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.36',
  zlib: '1.2.11' }
$ node -p process.platform
linux

We’re running on Ubuntu 14.04.6 LTS, and this is not running in Docker or other container.