npm Community Forum (Archive)

The npm community forum has been discontinued.

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

Dependency of private module not installed

What I Wanted to Do

Install packages npm i

What Happened Instead

The packages installed but one of my private packages is missing its one dependency.

Reproduction Steps

Fork react-image-annotation on github
Modify packages.json to change the name and version and publish to a private registry, I use Gitlab.
Reference the package in another project (make sure you have configured the registry and authtoken)
Attempt install of packages npm i


react-image-annotation depends on styled-components, when I install my modified version from a private registry on Gitlab the styled-components dependency is ignored.

Note that the module is found in the private registry and downloaded and its package.json specifies the dependency on styled-components, see snippet:

  "bundleDependencies": false,
  "dependencies": {
    "styled-components": "^3.1.6"
  "deprecated": false,

I can work around it for now by adding styled-components as a top level dependency.

Platform Info

$ npm --versions
{ npm: '6.4.1',
  ares: '1.15.0',
  cldr: '33.1',
  http_parser: '2.9.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.15.0',
  openssl: '1.1.1',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.24.1',
  v8: '',
  zlib: '1.2.11' }

$ node -p process.platform

Try doing

rm -rf node_modules
npm install

worked for me :slight_smile:

Thank you for the suggestion Aditya, I have deleted node_modules, npm cache clean, npm cache verify, npm cache clean --force, and even deleted the cache directory entirely. Always the same, it doesn’t install the dependency of this module. Interestingly, if I set the top level dependency to a different version than in the module both get installed.