Closed jeong-sik closed 2 years ago
Hmm, copying the right binaries in postinstall is essential for rescript-relay
to work. How does that work in workspaces?
Hmm, copying the right binaries in postinstall is essential for
rescript-relay
to work. How does that work in workspaces?
/packages/workspace-a /packages/workspace-b
using yarn berry Workspaces a and b both use rescript-relay .
{
"name": "workspace-a",
"version": "0.0.1",
"dependencies": {
"rescript-relay": "1.0.0-beta.20"
}
}
{
"name": "workspace-b",
"version": "0.0.1",
"dependencies": {
"rescript-relay": "1.0.0-beta.20"
}
}
I'm not sure why exactly, but it looks like postinstall.js is executed twice in the yarn link step.
So, after the first copyPlatformBinaries and removeInitialBinaries functions are executed, an error seems to occur when the next copyPlatformBinaries function is executed.
$ yarn
➤ YN0000: ┌ Project validation
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 696ms
➤ YN0000: ┌ Link step
➤ YN0007: │ rescript-relay@npm:1.0.0-beta.20 [2f1dd] must be built because it never has been before or the last one failed
➤ YN0009: │ rescript-relay@npm:1.0.0-beta.20 [2f1dd] couldn't be built successfully (exit code 1, logs can be found here: /private/var/folders/_9/4r7lk75947nd53l3751p8ltw0000gn/T/ xfs-50b4fda1/build.log)
➤ YN0000: └ Completed in 1s 74ms
Running `afterInstall` hook...
➤ YN0000: Done in 0s
➤ YN0000: Failed with errors in 3s 691ms
Come to think of it, this seems to be a yarn issue, not this project issue. 😅🙏
Postinstall error when using yarn workspace. A patch that protects this case.
https://github.com/yarnpkg/yarn/issues/7694
build.log