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

corepack prepare doesn't work for tags including a number #164

Closed
teppeis opened this issue Aug 21, 2022 · 1 comment · Fixed by #165
Closed

corepack prepare doesn't work for tags including a number #164

teppeis opened this issue Aug 21, 2022 · 1 comment · Fixed by #165

Comments

@teppeis
Copy link
Contributor

teppeis commented Aug 21, 2022

corepack prepare npm@latest works but corepack prepare npm@latest-7 doesn't.

The result in corepack@0.13.0:

$ corepack prepare npm@latest-7
Type Error: Invalid comparator: latest-7
    at Comparator.parse (/Users/teppeis/.nodenv/versions/18.7.0/lib/node_modules/corepack/dist/corepack.js:3370:13)
    at new Comparator (/Users/teppeis/.nodenv/versions/18.7.0/lib/node_modules/corepack/dist/corepack.js:3354:10)
    at /Users/teppeis/.nodenv/versions/18.7.0/lib/node_modules/corepack/dist/corepack.js:3611:47
    at Array.map (<anonymous>)
    at Range.parseRange (/Users/teppeis/.nodenv/versions/18.7.0/lib/node_modules/corepack/dist/corepack.js:3611:35)
    at /Users/teppeis/.nodenv/versions/18.7.0/lib/node_modules/corepack/dist/corepack.js:3512:22
    at Array.map (<anonymous>)
    at new Range (/Users/teppeis/.nodenv/versions/18.7.0/lib/node_modules/corepack/dist/corepack.js:3512:8)
    at Module.findInstalledVersion (/Users/teppeis/.nodenv/versions/18.7.0/lib/node_modules/corepack/dist/corepack.js:15788:19)
    at async Engine.resolveDescriptor (/Users/teppeis/.nodenv/versions/18.7.0/lib/node_modules/corepack/dist/corepack.js:15214:31)
(node:45466) Warning: Closing directory handle on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)

This regex seems to be the cause.

if (/^[a-z-]+$/.test(descriptor.range)) {

@aduh95
Copy link
Contributor

aduh95 commented Aug 21, 2022

Would you be interested in sending a PR to fix that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants