Yarn berry error: must be built because it never has been before or the last one failed
Asked Answered
K

1

33

I upgraded our project to yarn berry recently. Still using node_modules with nodeLinker: node-modules.

When running 'yarn' command i see below errors:

➤ YN0000: ┌ Link step
➤ YN0007: │ core-js@npm:2.6.12 must be built because it never has been before or the last one failed
➤ YN0007: │ @getgauge/cli@npm:1.4.3 must be built because it never has been before or the last one failed
➤ YN0007: │ protobufjs@npm:6.11.3 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:3.18.3 must be built because it never has been before or the last one failed
➤ YN0007: │ husky@npm:3.1.0 must be built because it never has been before or the last one failed
➤ YN0007: │ node-sass@npm:7.0.1 must be built because it never has been before or the last one failed
➤ YN0007: │ taiko@npm:1.2.7 must be built because it never has been before or the last one failed
➤ YN0007: │ taiko@npm:1.3.1 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js-pure@npm:3.18.3 must be built because it never has been before or the last one failed

I am not sure why yarn is asking to build these packages. Earlier we never used to build a package inside node_modules. How can i fix this?

Knavish answered 19/9, 2022 at 19:30 Comment(2)
I'm facing the same issue during CI. Could you solve it?Preoccupy
got this after OS upgrade, had to follow the message in the error log You have not agreed to the Xcode license agreements. Please run 'sudo xcodebuild -license' from within a Terminal window to review and agree to the Xcode and Apple SDKs license.Willpower
H
5

In my project, when running into this error, prior to the Link step as quoted in the question above, where I was also getting a number of must be built because it never has been before or the last one failed errors, there were a number of warnings in the Resolution step, like:

➤ YN0000: ┌ Resolution step
➤ YN0002: │ vendor-frontend@workspace:. doesn't provide @babel/core (pa3ad5), requested by @babel/plugin-proposal-class-properties
➤ YN0002: │ vendor-frontend@workspace:. doesn't provide @babel/core (p4b1ed), requested by @babel/plugin-proposal-decorators
➤ YN0002: │ (... about a dozen more ...)
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 239ms

As Yarn suggests in that last message, I ran:

yarn explain peer-requirements pxxxxx

where in my case pxxxxx was actually pa3ad5, the code from the first of those "doesn't provide" warnings.

For me, this produced:

➤ YN0000: vendor-frontend@workspace:. doesn't provide @babel/core, breaking the following requirements:
➤ YN0000: @babel/helper-create-class-features-plugin@npm:7.20.7 [967d5] → ^7.0.0   ✘
➤ YN0000: @babel/plugin-proposal-class-properties@npm:7.18.6 [8c8ef]    → ^7.0.0-0 ✘
➤ YN0000: Note: these requirements start with @babel/plugin-proposal-class-properties@npm:7.18.6 [8c8ef]

"npm", eh? This prompted me to run:

npm install

This completed successfully:

added 23 packages, removed 32 packages, changed 18 packages, and audited 1351 packages in 15s

But my app (running in my local dev environment) was still showing a compile error.

So I tried circling back to the original command, once again running:

yarn install

This completed successfully, and got my local app up and running again.

Huberthuberto answered 27/6, 2023 at 19:57 Comment(1)
Mixing npm with yarn like that probably worked out of coincidence and you got totally lucky, because both tools do different things to node_modules and will definitely cause issues used together like that.Threnody

© 2022 - 2024 — McMap. All rights reserved.