npm-check-updates icon indicating copy to clipboard operation
npm-check-updates copied to clipboard

Error when installing new versions using pnpm

Open andrei-zgirvaci opened this issue 2 years ago • 3 comments

  • [x] I have searched for similar issues
  • [x] I am using the latest version of npm-check-updates
  • [x] I am using node >= 14

Steps to Reproduce

.ncurc:


Dependencies:


Steps:

  1. Run: ncu --upgrade --interactive --format group
  2. Select packages (doesn't matter which or how many)
  3. When asked if you would like to install new versions using pnpm, type Yes

Current Behavior

An error is thrown:

/Users/andrei/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/npm-check-updates/build/src/index.js:57
    throw err;
    ^

Expected Behavior

No errors should be thrown

Thank you in advance for the help on this matter as I am curious if my pnpm has some issues or if it's something else!

andrei-zgirvaci avatar Sep 17 '22 14:09 andrei-zgirvaci

It works as expected for me:

raine[1191]% cat package.json
{
  "dependencies": {
    "ncu-test-v2": "1.0.0"
  }
}
raine[1191]% ncu --upgrade --interactive --format group
Upgrading /Users/raine/projects/ncu-issues/1191/package.json
[====================] 1/1 100%

✔ Choose which packages to update ›

 ncu-test-v2  1.0.0  →  2.0.0

✔ Run pnpm install to install new versions? … yes

git diff:

diff --git a/package.json b/package.json
index 84c652e..a3a9f05 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,6 @@
   },
   "license": "ISC",
   "dependencies": {
-    "ncu-test-v2": "1.0.0"
+    "ncu-test-v2": "2.0.0"
   }
 }
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 89485a7..e0ce226 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1,13 +1,13 @@
 lockfileVersion: 5.4

 specifiers:
-  ncu-test-v2: 1.0.0
+  ncu-test-v2: 2.0.0

 dependencies:
-  ncu-test-v2: 1.0.0
+  ncu-test-v2: 2.0.0

 packages:

-  /ncu-test-v2/1.0.0:
-    resolution: {integrity: sha512-Oaw47teUXoN1tzTj8h+q1NiMlRRJeG9cs2EyPkITLogRcsoe3Z/QiTc7dgZdXh8Pm4TL0VhvGz0hnqsR20XFWw==}
+  /ncu-test-v2/2.0.0:
+    resolution: {integrity: sha512-Jqu6DzpKkTrUdeL+VN/X4lz4IVDxkNAqVHmyJ+3uVcszqPlU8JMNTA2qeihzMcbd4pOiagKlJno7r+EO2WLmfw==}
     dev: false

raineorshine avatar Sep 19 '22 15:09 raineorshine

@raineorshine sorry, forgot to mention.

Indeed the package.json, pnpm-lock.yaml and node_modules does get updated, but and error is thrown after.

The error doesn't screw anything up, it's just annoying to see it every time and I am curious if other people have it too...

andrei-zgirvaci avatar Sep 20 '22 18:09 andrei-zgirvaci

I'm not seeing any error on my side when I run the command as described. Without being able to reproduce it there's not much I can do, but maybe somebody who can reproduce it is able to investigate.

raineorshine avatar Sep 21 '22 02:09 raineorshine

Reproduction: asciicast

Repository: https://github.com/leosuncin/nest-api-example

leosuncin avatar Sep 27 '22 22:09 leosuncin

And it gets worst with --doctor

npm-check-updates --upgrade --doctor

ncu -u --doctor

npm-check-updates --upgrade --doctor --doctorTest='pnpm test' --doctorInstall='pnpm install'

ncu -u --doctor --doctorTest='pnpm test' --doctorInstall='pnpm install'

leosuncin avatar Sep 27 '22 22:09 leosuncin

Thanks for the repo. I was able to reproduce the issue.

I found that pnpm was silently failing with ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies. Actually, if pnpm install is run manually in the terminal from the same starting point. the same error occurs. It just gets resolved the second time pnpm install is run (presumably once webpack is installed).

It may occur in pnpm install itself, but is still a pain, so I disabled strict-peer-dependencies when run within npm-check-updates. This fixed the issue for me.

The reason the error was not printed out is that pnpm incorrectly writes it to stdout instead of stderr. I opened an issue here: https://github.com/pnpm/pnpm/issues/5419. I also updated npm-check-updates to print stdout if stderr is empty. Now you should at least be able to see the exact error message if pnpm install fails.

Published in npm-check-updates v16.3.3

raineorshine avatar Sep 28 '22 13:09 raineorshine

And it gets worst with --doctor

Please open a separate issue with steps to reproduce if the error with --doctor still occurs after upgrading to v16.3.3.

raineorshine avatar Sep 28 '22 13:09 raineorshine