npm doesn't install local package dependencies


(Javier Rosas) #1

What I Wanted to Do

This is a follow up of

In a monorepo, I want to be able to share code between two projects by using top-level folders as local packages.

I run npm install on one of the project folders and I expected that to also install the dependencies for the common library.

What Happened Instead

npm install doesn’t install dependencies for local packages

Reproduction Steps

$ git clone
$ cd npm-bug-local-packages/server
$ npm install
$ node index.js

Platform Info

$ npm --versions
{ server: '1.0.0',
  npm: '6.2.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  nghttp2: '1.25.0',
  node: '8.11.1',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.50',
  zlib: '1.2.11' }
$ node -p process.platform

(Kat Marchán) #2

Triage note: I’m not sure we ever intended to install deps like this. /cc @iarna

(Rebecca Turner) #3

Yes, this should be installing the dependencies per the spec:

If the module is outside the package root then dependencies will be installed inside the linked module’s node_modules folder.

That’s supposed to be covered by this test:

So the challenge will be figuring out where this test is going wrong (or how the real-world scenario differs from it).

(Jaime Alberto Giraldo Jimenez) #4

Hi @javorosas,

Today I had the same issue you have. Digging into the package-lock.json I noticed an specific parameter on this kind of submodules dependencies which is bundled. This parameter says to npm install that it’s already in the the specified folder (not being required). So… there is another command that is intended more for production installations which is npm ci this command validates that module dependencies are installed and install them if required.

Hope this help!

(system) closed #5

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