[BUG] npm-shrinkwraps not respected for global installs of local packages? #5325
Labels
Bug
thing that needs fixing
Needs Triage
needs review for next steps
Release 8.x
work is associated with a specific npm 8 release
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When globally installing a package that contains an
npm-shrinkwrap.json
file, it's not respected. It's actually always installing the latest version, just as it the shrinkwrap file wasn't there.This kind of defeats the purpose its serves - as per https://docs.npmjs.com/cli/v8/configuring-npm/npm-shrinkwrap-json:
The recommended use-case for npm-shrinkwrap.json is applications deployed through the publishing process on the registry: for example, daemons and command-line tools intended as global installs.
I was actually looking into moving to use that shrinkwrap file exactly for that in coder/code-server#5071 - vending it installed as a global install with deterministic dependencies - because we had issues with latest releases not being compatible. But realized it doesn't actually work at all...
Expected Behavior
As per https://docs.npmjs.com/cli/v8/configuring-npm/npm-shrinkwrap-json, I'd would expect a global install to use the versions from the shrinkwrap file - even when doing a global install...
When doing a non-global install, it works as expected.
Steps To Reproduce
Resulting tgz: test-1.0.0.tgz
One would expect
[email protected]
in the dependencies.But
[email protected]
(at the moment of this writing, the latest version) gets installed:More confirmations:
/home/ubuntu/.nvm/versions/node/v16.17.0/lib/node_modules/test/npm-shrinkwrap.json
shows[email protected]
as expected/home/ubuntu/.nvm/versions/node/v16.17.0/lib/node_modules/test/node_modules/lru-cache/package.json
shows"version": "7.14.0"
Environment
The text was updated successfully, but these errors were encountered: