Skip to content
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

Update fail to compare version using git #7415

Closed
2 of 4 tasks
thib3113 opened this issue Dec 13, 2023 · 8 comments · Fixed by #7440
Closed
2 of 4 tasks

Update fail to compare version using git #7415

thib3113 opened this issue Dec 13, 2023 · 8 comments · Fixed by #7440

Comments

@thib3113
Copy link

thib3113 commented Dec 13, 2023

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

8.12.1

Which area(s) of pnpm are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://github.com/thib3113/pnpm-issue-7415

In this repos, need to do (I already add overrides) :

pnpm i
pnpm update -r --latest -i

Reproduction steps

  • add pnpm overrides using github dependency
  • run p update -r --latest -i (without -r or -i seems to doesn't reproduce the bug)

Describe the Bug

pnpm seems to try to compare the "github version" (as stored in the lockFile), with another version using semver

 ERROR  Invalid Version: github.com/thib3113/moleculer-web/9e13e537cd218585750d674c75b6d8666423be70(moleculer@0.14.31)

pnpm: Invalid Version: github.com/thib3113/moleculer-web/9e13e537cd218585750d674c75b6d8666423be70(moleculer@0.14.31)
    at new _SemVer (C:\Users\thib3113\AppData\Local\pnpm\global\5\.pnpm\pnpm@8.12.1\node_modules\pnpm\dist\pnpm.cjs:44104:17)
    at compare (C:\Users\thib3113\AppData\Local\pnpm\global\5\.pnpm\pnpm@8.12.1\node_modules\pnpm\dist\pnpm.cjs:44470:36)
    at Object.lt (C:\Users\thib3113\AppData\Local\pnpm\global\5\.pnpm\pnpm@8.12.1\node_modules\pnpm\dist\pnpm.cjs:44537:31)
    at C:\Users\thib3113\AppData\Local\pnpm\global\5\.pnpm\pnpm@8.12.1\node_modules\pnpm\dist\pnpm.cjs:192423:55
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 6)
    at async C:\Users\thib3113\AppData\Local\pnpm\global\5\.pnpm\pnpm@8.12.1\node_modules\pnpm\dist\pnpm.cjs:192374:9
    at async Promise.all (index 2)
    at async outdated (C:\Users\thib3113\AppData\Local\pnpm\global\5\.pnpm\pnpm@8.12.1\node_modules\pnpm\dist\pnpm.cjs:192367:7)
    at async Promise.all (index 6)

Expected Behavior

other way to check git repository (not with semver ? but by git hash ?)

Which Node.js version are you using?

20.8.0

Which operating systems have you used?

  • macOS
  • Windows
  • Linux
@KSXGitHub
Copy link
Contributor

I cannot reproduce it in my Linux machine.

screenshot

It suspect this only happens in Windows.

@thib3113
Copy link
Author

thib3113 commented Dec 16, 2023

@KSXGitHub can you tell us more about your linux machine ?

I just try on another windows machine (not clean / I use it to developp too, so maybe a common configuration problem), and got the same problem . But I also tryed on WSL, and got the nearly same error :

Scope: all 2 workspace projects
 ERROR  Invalid Version: github.com/thib3113/moleculer/fa57f622653eb13f11f772847c27c30c2c8d617b

pnpm: Invalid Version: github.com/thib3113/moleculer/fa57f622653eb13f11f772847c27c30c2c8d617b
    at new _SemVer (/mnt/c/Users/thib3113/AppData/Local/pnpm/global/5/.pnpm/pnpm@8.12.1/node_modules/pnpm/dist/pnpm.cjs:44104:17)
    at compare (/mnt/c/Users/thib3113/AppData/Local/pnpm/global/5/.pnpm/pnpm@8.12.1/node_modules/pnpm/dist/pnpm.cjs:44470:36)
    at Object.lt (/mnt/c/Users/thib3113/AppData/Local/pnpm/global/5/.pnpm/pnpm@8.12.1/node_modules/pnpm/dist/pnpm.cjs:44537:31)
    at /mnt/c/Users/thib3113/AppData/Local/pnpm/global/5/.pnpm/pnpm@8.12.1/node_modules/pnpm/dist/pnpm.cjs:192423:55
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async /mnt/c/Users/thib3113/AppData/Local/pnpm/global/5/.pnpm/pnpm@8.12.1/node_modules/pnpm/dist/pnpm.cjs:192374:9
    at async Promise.all (index 1)
    at async outdated (/mnt/c/Users/thib3113/AppData/Local/pnpm/global/5/.pnpm/pnpm@8.12.1/node_modules/pnpm/dist/pnpm.cjs:192367:7)
    at async Promise.all (index 1)

( If I have some time, I will setup the debugger to check more on this error )

@KSXGitHub
Copy link
Contributor

@thib3113 I just cloned your repo and run it. Is that the right step? I noticed that the root package.json already have overrides so I didn't add any.

@thib3113
Copy link
Author

thib3113 commented Dec 16, 2023

@KSXGitHub did you have install dependencies before ?

pnpm i
pnpm update -r --latest -i

Else, what is your linux distribution ? ( because, seems strange that it works on linux, but not on wsl debian 11)

@KSXGitHub
Copy link
Contributor

@thib3113 I see. The error has been reproduced.

@KSXGitHub
Copy link
Contributor

I have located the cause of the error to be at a semver.lt calls:

if (current !== wanted || semver.lt(current, latestManifest.version) || latestManifest.deprecated) {

Expected Behavior

other way to check git repository (not with semver ? but by git hash ?)

Your desired behavior is quite complex to implement right now, so I'll probably fix this error by ignoring non-semver values of current.

@thib3113
Copy link
Author

@KSXGitHub I understand, no problem . maybe you can just ask if the person want to update ? without comparing value with next one ? and so we can check or not to do the update ?

@KSXGitHub
Copy link
Contributor

KSXGitHub commented Dec 18, 2023

Actually, it was caused by parsePref failing to detect non-semver versions:

parsePref(allDeps[alias], alias, 'latest', pickRegistryForPackage(opts.registries, name)) == null

The true fix turns out to be more complicated than I initially thought.

KSXGitHub added a commit that referenced this issue Dec 18, 2023
zkochan pushed a commit that referenced this issue Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants