-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[BUG] Installing newer version from git doesn't update package lock nor node modules #3333
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
hi @Goues thank you for taking the time to submit this issue, I believe this has been fixed in a past release of the npm cli and it works as expected in the current version ( I run a quick reproduction and it seems to work as expected:
Which gives me the following setup: commit ec64ce6cc0b85025ba13f545e947117c5e9362ff
Author: Ruy Adorno <ruyadorno@hotmail.com>
Date: Wed Mar 2 14:49:38 2022 -0500
Initial commit
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..bb662dd
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,27 @@
+{
+ "name": "3333-git-repo-dep-lockfile-entry-issue",
+ "version": "1.0.0",
+ "lockfileVersion": 2,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "3333-git-repo-dep-lockfile-entry-issue",
+ "version": "1.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "abbrev": "github:npm/abbrev-js#v1.0.4"
+ }
+ },
+ "node_modules/abbrev": {
+ "version": "1.0.4",
+ "resolved": "git+ssh://git@github.com/npm/abbrev-js.git#1ce81404a57d87662f1a93be23a389ead514f7a6",
+ "license": "MIT"
+ }
+ },
+ "dependencies": {
+ "abbrev": {
+ "version": "git+ssh://git@github.com/npm/abbrev-js.git#1ce81404a57d87662f1a93be23a389ead514f7a6",
+ "from": "abbrev@git+https://github.com/npm/abbrev-js.git#v1.0.4"
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..6129baf
--- /dev/null
+++ b/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "3333-git-repo-dep-lockfile-entry-issue",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo /"Error: no test specified/" && exit 1"
+ },
+ "keywords": [],
+ "author": "Ruy Adorno <ruyadorno@hotmail.com> (https://ruyadorno.com/)",
+ "license": "MIT",
+ "dependencies": {
+ "abbrev": "github:npm/abbrev-js#v1.0.4"
+ }
+} Once I update the dependency to a different version:
You can see the lock file hash was updated as expected: diff --git a/package-lock.json b/package-lock.json
index bb662dd..c9fc3c6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,19 +9,19 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
- "abbrev": "github:npm/abbrev-js#v1.0.4"
+ "abbrev": "github:npm/abbrev-js#v1.1.1"
}
},
"node_modules/abbrev": {
- "version": "1.0.4",
- "resolved": "git+ssh://git@github.com/npm/abbrev-js.git#1ce81404a57d87662f1a93be23a389ead514f7a6",
- "license": "MIT"
+ "version": "1.1.1",
+ "resolved": "git+ssh://git@github.com/npm/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
+ "license": "ISC"
}
},
"dependencies": {
"abbrev": {
- "version": "git+ssh://git@github.com/npm/abbrev-js.git#1ce81404a57d87662f1a93be23a389ead514f7a6",
- "from": "abbrev@git+https://github.com/npm/abbrev-js.git#v1.0.4"
+ "version": "git+ssh://git@github.com/npm/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
+ "from": "abbrev@git+https://github.com/npm/abbrev-js.git#v1.1.1"
}
}
}
diff --git a/package.json b/package.json
index 6129baf..8f6a90d 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,6 @@
"author": "Ruy Adorno <ruyadorno@hotmail.com> (https://ruyadorno.com/)",
"license": "MIT",
"dependencies": {
- "abbrev": "github:npm/abbrev-js#v1.0.4"
+ "abbrev": "github:npm/abbrev-js#v1.1.1"
}
} I'm going to close this issue as it seems to be working as expected (using Thanks again! |
Is there an existing issue for this?
Current Behavior
I have a module installed from git with a specific version (git tag), updating that module to a newer version updates only package.json and dependencies in package-lock.json but not the
version
URL in the package lock, resulting in having an incorrect version in node modules directory.This is what my package.json looks like before updating:
This is what my package-lock.json looks like before updating:
After updating with
npm install -S "git+https://<redacted>@bitbucket.org/<redacted>/internal-package.git#v4.0.0"
, they become:and
As you can see here, the hash of the commit tagged as v3.1.7 stayed in
version
field and that is the version that is in the end installed in node modules.This setup was fully working on npm6 and only started failing on npm7.
Expected Behavior
Package lock is updated correctly and the right version is installed.
Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: