Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Command failed when installing using yarn #2812

Closed
alvesvaren opened this issue Jan 10, 2023 · 4 comments
Closed

Error: Command failed when installing using yarn #2812

alvesvaren opened this issue Jan 10, 2023 · 4 comments

Comments

@alvesvaren
Copy link

I have a Next.js-project with esbuild as a dependency to a package (not in package.json)

When I run yarn to install all dependencies, the esbuild install.js-script fails with the following output:

yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "eslint-plugin-react@^7.28.0".
warning " > [email protected]" has unmet peer dependency "preact-ssr-prepass@>=1".
warning "next-plugin-preact > @prefresh/[email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "next-plugin-preact > @prefresh/[email protected]" has unmet peer dependency "@prefresh/babel-plugin@^0.4.0".
warning "next-plugin-preact > @prefresh/[email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning " > [email protected]" has unmet peer dependency "react-is@>= 16.8.0".
[4/4] Building fresh packages...
[6/8] ⠄ next-plugin-preact
[7/8] ⠄ sharp
[3/8] ⠄ esbuild
[4/8] ⠄ odiff-bin
error /home/alve/dev/project/node_modules/esbuild: Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /home/alve/dev/project/node_modules/esbuild
Output:
node:internal/errors:857
  const err = new Error(message);
              ^

Error: Command failed: /usr/bin/node /home/alve/dev/project/node_modules/esbuild/bin/esbuild --version
node:child_process:899
    throw err;
    ^

<ref *1> Error: spawnSync /usr/bin/esbuild ENOENT
    at Object.spawnSync (node:internal/child_process:1119:20)
    at spawnSync (node:child_process:847:24)
    at Object.execFileSync (node:child_process:890:15)
    at Object.<anonymous> (/home/alve/dev/project/node_modules/esbuild/bin/esbuild:2:26)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawnSync /usr/bin/esbuild',
  path: '/usr/bin/esbuild',
  spawnargs: [ '--version' ],
  error: [Circular *1],
  status: null,
  signal: null,
  output: null,
  pid: 0,
  stdout: null,
  stderr: null
}

    at checkExecSyncError (node:child_process:861:11)
    at Object.execFileSync (node:child_process:896:15)
    at validateBinaryVersion (/home/alve/dev/project/node_modules/esbuild/install.js:90:32)
    at /home/alve/dev/project/node_modules/esbuild/install.js:241:5 {
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(0) [Uint8Array] [],
    Buffer(1016) [Uint8Array] [
      110, 111, 100, 101,  58,  99, 104, 105, 108, 100,  95, 112,
      114, 111,  99, 101, 115, 115,  58,  56,  57,  57,  10,  32,
       32,  32,  32, 116, 104, 114, 111, 119,  32, 101, 114, 114,
       59,  10,  32,  32,  32,  32,  94,  10,  10,  60, 114, 101,
      102,  32,  42,  49,  62,  32,  69, 114, 114, 111, 114,  58,
       32, 115, 112,  97, 119, 110,  83, 121, 110,  99,  32,  47,
      117, 115, 114,  47,  98, 105, 110,  47, 101, 115,  98, 117,
      105, 108, 100,  32,  69,  78,  79,  69,  78,  84,  10,  32,
       32,  32,  32,  97,
      ... 916 more items
    ]
  ],
  pid: 150407,
  stdout: Buffer(0) [Uint8Array] [],
  stderr: Buffer(1016) [Uint8Array] [
    110, 111, 100, 101,  58,  99, 104, 105, 108, 100,  95, 112,
    114, 111,  99, 101, 115, 115,  58,  56,  57,  57,  10,  32,
     32,  32,  32, 116, 104, 114, 111, 119,  32, 101, 114, 114,
     59,  10,  32,  32,  32,  32,  94,  10,  10,  60, 114, 101,
    102,  32,  42,  49,  62,  32,  69, 114, 114, 111, 114,  58,
     32, 115, 112,  97, 119, 110,  83, 121, 110,  99,  32,  47,
    117, 115, 114,  47,  98, 105, 110,  47, 101, 115,  98, 117,
    105, 108, 100,  32,  69,  78,  79,  69,  78,  84,  10,  32,
     32,  32,  32,  97,




I have tried removing the yarn.lock-file so that the latest version gets installed but that gives the same error.

It installs fine when using npm install in the same project.

@evanw
Copy link
Owner

evanw commented Jan 10, 2023

<ref *1> Error: spawnSync /usr/bin/esbuild ENOENT

This is a sign that you have messed with esbuild’s installer using the ESBUILD_BINARY_PATH variable. See also #2785. This is a problem on your end. It’s not a problem with esbuild.

@alvesvaren
Copy link
Author

Yeah, unsetting that variable made it work fine. Weird because there's nothing at that path for me. Will see if I can find why it was set.

Thank you!

@alvesvaren
Copy link
Author

It was set in /etc/profile.d/esbuild.sh which seems to be created by the esbuild aur package https://aur.archlinux.org/packages/esbuild

I broke my package database a while back so it is possible that I had that package installed then. Removing that file and rebooting solves the issue for me

@airtonix
Copy link

fedora 37, never installed any kind of esbuild package via dnf (i consider this to be heresy), am just now getting this error after attempting to install react-cosmo@6.

never touched ESBUILD_BINARY_PATH (didn't know it existed until i started googling error logs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants