npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm ci fails with recursive local dependencies

What I Wanted to Do

Run npm ci on a package that has recursive local packages

What Happened Instead

npm WARN prepare removing existing node_modules/ before installation
npm ERR! path /Source/TestNpm/test/node_modules/nightmare/node_modules/deep-defaults
npm ERR! code EEXIST
npm ERR! errno -17
npm ERR! syscall mkdir
npm ERR! EEXIST: file already exists, mkdir '/Source/TestNpm/test/node_modules/nightmare/node_modules/deep-defaults'
npm ERR! File exists: /Source/TestNpm/test/node_modules/nightmare/node_modules/deep-defaults
npm ERR! Move it away, and try again.

Reproduction Steps

git clone
git clone
cd nightmare/
npm remove deep-defaults
npm install ../deep-defaults --save
cd ..
mkdir test
cd test
npm init -y
npm install ../nightmare
npm ci # This reproduces bug
npm install # This now causes ENOENT bug. Fix by rm -rf node_modules package-lock.json

Platform Info

$ npm --versions
{ test: '1.0.0',
  npm: '6.3.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.11.3',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' }
$ node -p process.platform