-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[BUG] npm 7.x: updating git dependency branch and/or refetching branch not working. #2844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
May be related to #2934 |
Same problem with And this issue doesn't come up with npm@6, but do only with npm@7 |
This is partially working in ~/D/n/bar $ grep abbrev package.json
"abbrev": "github:isaacs/abbrev-js#v1.1.0"
~/D/n/bar $ npm ls abbrev
[email protected] /Users/wraithgar/Development/npm/bar
└── [email protected] (git+ssh://[email protected]/isaacs/abbrev-js.git#7136d4d95449dc44115d4f78b80ec907724f64e0)
~/D/n/bar $ cp new.json package.json
overwrite package.json? (y/n [n]) y
~/D/n/bar $ grep abbrev package.json
"abbrev": "github:isaacs/abbrev-js#v1.1.1"
~/D/n/bar $ npm i abbrev
changed 1 package, and audited 2 packages in 2s
found 0 vulnerabilities
~/D/n/bar $ npm ls abbrev
[email protected] /Users/wraithgar/Development/npm/bar
└── [email protected] (git+ssh://[email protected]/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb) |
This is likely going to stay as it is now. The issue has to do with the fact that git branches are not idempotent. There is also no reliable way for us to know if the content after the Consider if you had a If someone were to then push to that branch, and you were to delete your package-lock and install again, the lockfile would resolve to a completely different git url i.e. This would be fine if The reason If you do need to change to a new version of a git ref, you are going to have to install that dep explicitly in order to have npm re-resolve it in the lockfile. |
Instead of treating all git dependencies as staled, can npm know a git dependency is stale when the tag in package.json doesn't match the lock file? Which should be enough to handle the use case in #2844 (comment) Otherwise, npm should at least throw an error when |
After upgrading from 6.x to 7.x I'm having trouble updating git-based dependencies.
Steps To Reproduce:
Setup:
The git dependency uses
npm prepare
to build the project on demand when installed. No dist files are git controlled.I pushed changes I want to test to a new branch on remote.
Steps:
npm i @our-scope/our-dep
Current Behavior:
and installs the wrong version
Expected Behavior:
npm i @our-scope/our-dep
), updates the package-lock with the correct commit, and runsprepare
on the latest version.Environment:
The text was updated successfully, but these errors were encountered: