I’m tring to install my projects packages with these:
- node v20.9.0
- yarn v4.0.2
- yarnrc -> nodeLinker: pnpm
- system -> Ubuntu 23.10
- multiple package project (using
workspaces
in the rootpackage.json
)
I get this error:
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0007: │ esbuild@npm:0.18.20 must be built because it never has been before or the last one failed
➤ YN0009: │ esbuild@npm:0.18.20 couldn't be built successfully (exit code 1, logs can be found here: /tmp/build.log)
➤ YN0000: └ Completed
➤ YN0000: · Failed with errors
here is some part of the build.log:
# Script name: postinstall
node:internal/errors:866
const err = new Error(message);
^
Error: Command failed: /.local/share/nvm/v20.9.0/bin/node /node_modules/.store/esbuild-npm-0.18.20-004a76d281/package/bin/esbuild --version
node:child_process:929
throw err;
^
<ref *1> Error: spawnSync /node_modules/.store/@esbuild-linux-x64-npm-0.18.20-de8e99b449/package/bin/esbuild EACCES
Does anyone have a clue why this happens?
If I change the nodeLinker
to node-modules
, esbuild
would install successfully. I couldn’t find any incompatibility with pnpm in the esbuild documentation.
2
Answers
EDIT:
after some more digging around I found two possible workarounds (both have cones):
sudo yarn install
npm install -g esbuild
Note:
esbuild since v0.15 supports Yarn PnP module linker 🙂
I also ran into this problem, and I think it has to do with this Yarn issue: https://github.com/yarnpkg/berry/issues/5344
I was able to work around it by setting the executable bit manually. The exact command will vary based on your operating system, CPU architecture, and the esbuild version you have installed, but if we use the path from the question, the command would be: