[Bug?]: yarn fails to run with TypeError
Self-service
- [ ] I'd be willing to implement a fix
Describe the bug
As of about 30 mins ago, I am unable to use Yarn. It seems like there's something invalid in https://repo.yarnpkg.com/4.6.0/packages/yarnpkg-cli/bin/yarn.js
I thought it might be an issue with my Yarn version (I was on 4.5.1) so I tried updating my packageManager to the latest.
When I run yarn after updating my packageManager in package.json, I get the following error:
! Corepack is about to download https://repo.yarnpkg.com/4.6.0/packages/yarnpkg-cli/bin/yarn.js
? Do you want to continue? [Y/n] y
➤ YN0001: TypeError: Invalid version. Must be a string. Got type "object".
at new t (xxxx/.cache/node/corepack/v1/yarn/4.6.0/yarn.js:132:14299)
at Oje (xxxx/.cache/node/corepack/v1/yarn/4.6.0/yarn.js:132:19226)
at Object.Vje [as gt] (xxxx/.cache/node/corepack/v1/yarn/4.6.0/yarn.js:132:19778)
at xxxx/.cache/node/corepack/v1/yarn/4.6.0/yarn.js:456:16130
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Nt.start (xxxx/.cache/node/corepack/v1/yarn/4.6.0/yarn.js:176:1995)
at async xE.execute (xxxx/.cache/node/corepack/v1/yarn/4.6.0/yarn.js:456:15488)
at async xE.validateAndExecute (xxxx/.cache/node/corepack/v1/yarn/4.6.0/yarn.js:94:787)
at async t.run (xxxx/.cache/node/corepack/v1/yarn/4.6.0/yarn.js:98:3249)
at async HDt (xxxx/.cache/node/corepack/v1/yarn/4.6.0/yarn.js:744:7928
Any thoughts? Could it be an upstream issue with corepack?
To reproduce
For me, all I had to do was run yarn to get it to repro. I'm connected to the internet and NodeJS version is v22.13.0
Environment
I can't get Yarn to run so here's my details manually:
macOS: 15.2 (24C101)
nodeJS: 22.13.0
Yarn: 4.5.1 and 4.6.0
Additional context
No response
Getting the same error I thought I was going crazy
Just started for me too within the last 30 minutes. running "yarn" just hangs. same stack trace.
Same error. Multiple reports coming through the Discord support channels as well.
It's working for me now, not sure what changed
Can someone from the Yarn team provide a postmortem on what happened?
Probably related to the GitHub outage earlier
Very likely indeed; I suspect the API started returning null on the latest tags in https://repo.yarnpkg.com/tags, causing a failure in the subsequent semver.gt comparison that checks once a day if Yarn is up-to-date. Now that we know it can happen we should update the types and guard against that.