npm install doesn't install new or updated dependencies of local dependency

What I Wanted to Do

I would like to install/update dependencies in my local dependency and not worry that I have to update package-lock.json in all my projects in monorepo that use this local dependency.

What Happened Instead

New or updated dependencies in local dependency are not installed if these changes are not present in the package-lock.json in project that uses local dependency. Even updated package-lock.json in local dependency doesn’t help, it is ignored.

Reproduction Steps

git clone https://github.com/fresk-nc/npm-local-demo.git
cd npm-local-demo/core
npm i --save commander
cd ..
git clean -fdx
cd www
npm i

Details

There is no problem if there are node_modules in the project, new/updated dependencies will be installed and package-lock.json will be updated.

Platform Info

$ npm --versions
6.9.0
$ node -p process.platform
darwin

After following the reproduction steps, I think this shows the issue you are describing?

$ npm ls commander
www@1.0.0 /Users/john/Documents/Sandpits/npm.community/7043/npm-local-demo/www
└─┬ core@1.0.0 -> /Users/john/Documents/Sandpits/npm.community/7043/npm-local-demo/core
  └── UNMET DEPENDENCY commander@^2.20.0
$ npm i
$ npm ls commander
www@1.0.0 /Users/john/Documents/Sandpits/npm.community/7043/npm-local-demo/www
└─┬ core@1.0.0 -> /Users/john/Documents/Sandpits/npm.community/7043/npm-local-demo/core
  └── commander@2.20.0 

Yeah right. Thanks for demonstrating.

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