If the packageManager field in package.json is set to yarn@3.x.x, yarn@4.x.x or pnpm@6.x.x, etc and the requested package manager is not installed, the name of detected package is wrongly concatenated with its version: yarn@berry@4.0.0, pnpm@6@6.0.0
$ echo '{"packageManager": "yarn@4.0.0"}' > package.json && ni
[ni] Detected yarn@berry but it doesn't seem to be installed.
✔ Would you like to globally install yarn@berry (https://yarnpkg.com/getting-started/install)? … yes
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "berry@4.0.0" of package "yarn@berry@4.0.0": Tags may not have any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-11-27T14_24_37_837Z-debug-0.log
$ echo '{"packageManager": "pnpm@6.0.0"}' > package.json && ni
[ni] Detected pnpm@6 but it doesn't seem to be installed.
✔ Would you like to globally install pnpm@6 (https://pnpm.io/6.x/installation)? … yes
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "6@6.0.0" of package "pnpm@6@6.0.0": Tags may not have any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-11-27T14_20_04_290Z-debug-0.log
Reproduction
Make sure that neither pnpm nor yarn are installed globally. And then run echo '{"packageManager": "yarn@4.0.0"}' > package.json && ni or echo '{"packageManager": "pnpm@6.0.0"}' > package.json && ni
Describe the bug
If the
packageManager
field inpackage.json
is set toyarn@3.x.x
,yarn@4.x.x
orpnpm@6.x.x
, etc and the requested package manager is not installed, the name of detected package is wrongly concatenated with its version:yarn@berry@4.0.0
,pnpm@6@6.0.0
Reproduction
Make sure that neither pnpm nor yarn are installed globally. And then run
echo '{"packageManager": "yarn@4.0.0"}' > package.json && ni
orecho '{"packageManager": "pnpm@6.0.0"}' > package.json && ni
System Info
Used Package Manager
npm
Validations