yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.4k stars 2.73k forks source link

yarn global commands break in 1.22.20 #9012

Closed realies closed 10 months ago

realies commented 10 months ago
+ apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 29.5 MB of archives.
After this operation, 189 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_18.x nodistro/main amd64 nodejs amd64 18.18.2-1nodesource1 [29.5 MB]
Fetched 29.5 MB in 1s (34.7 MB/s)
Selecting previously unselected package nodejs.
(Reading database ... 62070 files and directories currently installed.)
Preparing to unpack .../nodejs_18.18.2-1nodesource1_amd64.deb ...
Unpacking nodejs (18.18.2-1nodesource1) ...
Setting up nodejs (18.18.2-1nodesource1) ...
Processing triggers for man-db (2.9.1-1) ...

+ npm install -g yarn
added 1 package in 1s
npm notice
npm notice New major version of npm available! 9.8.1 -> 10.2.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.2.3
npm notice Run npm install -g npm@10.2.3 to update!

+ echo 'export PATH="$(yarn global bin):$PATH"'
++ yarn global bin
Error: Couldn't find a package.json file in "/home/ubuntu"
    at MessageError.ExtendableBuiltin (/usr/lib/node_modules/yarn/lib/cli.js:721:66)
    at new MessageError (/usr/lib/node_modules/yarn/lib/cli.js:750:123)
    at /usr/lib/node_modules/yarn/lib/cli.js:41356:15
    at Generator.next (<anonymous>)
    at step (/usr/lib/node_modules/yarn/lib/cli.js:310:30)
    at /usr/lib/node_modules/yarn/lib/cli.js:321:13

while 1.22.19 works fine

+ apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 29.5 MB of archives.
After this operation, 189 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_18.x nodistro/main amd64 nodejs amd64 18.18.2-1nodesource1 [29.5 MB]
Fetched 29.5 MB in 1s (37.6 MB/s)
Selecting previously unselected package nodejs.
(Reading database ... 62070 files and directories currently installed.)
Preparing to unpack .../nodejs_18.18.2-1nodesource1_amd64.deb ...
Unpacking nodejs (18.18.2-1nodesource1) ...
Setting up nodejs (18.18.2-1nodesource1) ...
Processing triggers for man-db (2.9.1-1) ...

+ npm install -g yarn@1.22.19
added 1 package in 1s
npm notice
npm notice New major version of npm available! 9.8.1 -> 10.2.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.2.3
npm notice Run npm install -g npm@10.2.3 to update!

+ echo 'export PATH="$(yarn global bin):$PATH"'
++ yarn global bin
+ export PATH=/home/ubuntu/.yarn/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

please don't break the package manager like this

realies commented 10 months ago

Using

npm install -g corepack
corepack enable yarn

instead of

npm install -g yarn

works.