npm Community Forum (Archive)

The npm community forum has been discontinued.

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

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
cd npm-local-demo/core
npm i --save commander
cd ..
git clean -fdx
cd www
npm i


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
$ node -p process.platform

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/
└─┬ core@1.0.0 -> /Users/john/Documents/Sandpits/
  └── UNMET DEPENDENCY commander@^2.20.0
$ npm i
$ npm ls commander
www@1.0.0 /Users/john/Documents/Sandpits/
└─┬ core@1.0.0 -> /Users/john/Documents/Sandpits/
  └── commander@2.20.0 

Yeah right. Thanks for demonstrating.