skip to Main Content

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 root package.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


  1. EDIT:

    after some more digging around I found two possible workarounds (both have cones):

    1. use root access to install deps since problem is caused by missing access permission: sudo yarn install
    2. use globally installed esbuild with npn – allows to use cli only npm install -g esbuild

    Note:
    esbuild since v0.15 supports Yarn PnP module linker 🙂

    Login or Signup to reply.
  2. 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:

    chmod +x node_modules/.store/@esbuild-linux-x64-npm-0.18.20-de8e99b449/package/bin/esbuild
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search