"npm prune --production" removes second-level git dependencies

What I Wanted to Do

I’ve created test repo https://github.com/doochik/npm-bug
Dependencies graph: npm-bug -> npm-bug-repo1 -> npm-bug-repo2
npm must install npm-bug-repo1 and npm-bug-repo2 to node_modules

What Happened Instead

npm prune --production remove npm-bug-repo2 from node_modules

Reproduction Steps

  1. git clone git@github.com:doochik/npm-bug.git
  2. cd npm-bug
  3. npm ci. At this point node_modules contains 2 dirs: npm-bug-repo1 and npm-bug-repo2
  4. npm prune --production. This command removes npm-bug-repo2 (second-level dependency) from node_mobules

As the result npm-bug-repo1 becomes unusable cause of missed dependency.


Double run npm prune --production restores npm-bug-repo2 to node_modules

Platform Info

$ npm --versions
{ npm: '6.5.0',
  ares: '1.15.0',
  cldr: '34.0',
  http_parser: '2.8.0',
  icu: '63.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.14.2',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }

$ node -p process.platform

$ node --version

I’ve tried npm@6.7.0 and all works as expected.

Seems that this is fixed in v6.6.0 or v6.7.0


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