fix: yarn install failed when dependency package using yarn in postin… #6350
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem this PR addresses?
when running
yarn install
script, there is an error occur:"xx must be built because it never has been before or the last one failed" and the postinstall script of the error package did not run correctly.
Preconditions:
yarn.js
yarn
command in thepostinstall
script.you can find more detail from minimal reproducible repo
How did you fix it?
after debug, i found the
linkersCustomData
did not restore correctly when running theyarn
in thepostinstall
script, which causing yarn command in postinstall script refused to run.so i tried calling
project.restoreInstallState()
when customData is missing to try restore the customData.after i fixed this issue, i found two little issue still showing:
project.findLocatorForLocation
yarn alway pass a path with a/
ending, but thelocatorByPath
map only contains key without/
ending.locator
should be a Locator struct instead of a stringi also fixed these two problem as the file changes show.
Checklist