npm ci --only=production fails with ENOENT error

triaged
(Rowan Oulton) #1

What I Wanted to Do

Use npm ci to install production-only dependencies, like npm install --production or npm install --only=production

What Happened Instead

An error was thrown:

npm WARN prepare removing existing node_modules/ before installation
npm ERR! path /mnt/node_modules/fstream/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/mnt/node_modules/fstream/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/rowan/.npm/_logs/2018-12-06T16_11_20_303Z-debug.log
npm install failed

Reproduction Steps

This is a little tricky as it may rely on our specific dependency tree, but all I did was run:

npm ci --only=production

Conversely, the following works without trouble:

npm ci

Details

Iโ€™m wary about sharing the logfile publicly as it lists many private dependencies of my employer, but Iโ€™d be happy to share it in private.

Hereโ€™s the end of it, though:

2508 info extractTree Done in 10.995s
2509 verbose updateJson updating json deps to include _from
2510 verbose teardown shutting down workers.
2511 info teardown Done in 0.001s
2512 verbose stack Error: ENOENT: no such file or directory, open '/mnt/dev645/node_modules/fstream/package.json'
2513 verbose cwd /mnt
2514 verbose Linux 4.4.0-1063-aws
2515 verbose argv "/usr/bin/node" "/usr/bin/npm" "ci" "--only=production"
2516 verbose node v10.1.0
2517 verbose npm  v6.0.1
2518 error path /mnt/node_modules/fstream/package.json
2519 error code ENOENT
2520 error errno -2
2521 error syscall open
2522 error enoent ENOENT: no such file or directory, open '/mnt/node_modules/fstream/package.json'
2523 error enoent This is related to npm not being able to find a file.
2524 verbose exit [ -2, true ]%

Platform Info

$ npm --versions
{ webapp: '1.0.0',
  npm: '6.0.1',
  ares: '1.14.0',
  cldr: '33.0',
  http_parser: '2.8.0',
  icu: '61.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.29.0',
  node: '10.1.0',
  openssl: '1.1.0h',
  tz: '2018c',
  unicode: '10.0',
  uv: '1.20.2',
  v8: '6.6.346.27-node.6',
  zlib: '1.2.11' }
$ node -p process.platform
darwin
(system) closed #2

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.