Skip to content
New issue

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

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

Already on GitHub? # to your account

Process failed: spawn /bin/sh ENOENT #883

Open
Quinn1876 opened this issue Jul 1, 2022 · 7 comments
Open

Process failed: spawn /bin/sh ENOENT #883

Quinn1876 opened this issue Jul 1, 2022 · 7 comments

Comments

@Quinn1876
Copy link

Environment

  1. vscode-jest version: v4.6.0
  2. node -v: v17.7.1
  3. npm -v or yarn --version: 8.12.2
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected):
    └─┬ react-scripts@5.0.1
    ├─┬ jest-watch-typeahead@1.1.0
    │ └── jest@27.5.1 deduped
    └── jest@27.5.1
  5. Operating system: Linux Mint 20.3

Prerequisite

  • are you able to run jest test from the command line? yes
  • how do you run your tests from the command line? npm run test

Steps to Reproduce

Install Jest Extension
Get error :
Jest Session Started
Process failed: spawn /bin/sh ENOENT
Process failed: spawn /bin/sh ENOENT
Jest process "watch-tests" ended unexpectedly

Expected Behavior

Should be able to run jest tests

Actual Behavior

Process Fails
Jest Session Started
Process failed: spawn /bin/sh ENOENT
Process failed: spawn /bin/sh ENOENT
Jest process "watch-tests" ended unexpectedly


The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...

@ocolot
Copy link

ocolot commented Jul 2, 2022

Same thing here with Node 16.15.1, VS Code 1.68.1 and Jest extension 4.6.0 running on Apple Silicon M2.

@connectdotz
Copy link
Collaborator

connectdotz commented Jul 9, 2022

@Quinn1876 @ocolot can you guys turn on debug mode and post the spawned command line from the developer console?

@connectdotz
Copy link
Collaborator

/bin/sh is the default shell nodejs used to spawn the child process for jest run. Is there a /bin/sh in your machine? what is the actual shell you are using? If you are using a different shell, feel free to set jest.shell accordingly.

@metin1
Copy link

metin1 commented Nov 28, 2022

I am also getting the same error. The error persists even though I set it to jest.shell "/bin/zsh". It works in debug mode and from the command line.

@Jeroendevr
Copy link

Jeroendevr commented Dec 18, 2022

  1. vs-code jest version : v4.6.0
  2. node --version: V18.12.1
  3. yarn --version: v3.3.0
  4. Operating Systen: macOS Ventura 13.1
  5. Shell: Fish v3.5.1

I could remember setting the shell to Fish in jest.shell didn't help.
What worked for me is opening the directory through the shell I use. code .
See Resolving Shell Environment Fails. Could it be the case that also in this case your default shell, - I assume bash on Linux - fails en defaults here to /bin/sh?
Also I ended up working with the pre-release version, does that change anything?

To sum up, try

  • Try setting jest.shell
  • Open the directory with code .
  • Use the pre-release version V5.0.4

Tried to reproduce it again this issue but I probably dit set some setting different and now It keeps working even without opening it through the shell.

@yadutaf
Copy link

yadutaf commented Dec 19, 2022

I had a similar issue and was able to solve it by removing a mis-configured "jest.rootPath setting. In my case, the Process failed: spawn /bin/sh ENOENT message was apparently actually referring to a cwd command rather than to /bin/sh itself.

@IgorVinoski
Copy link

IgorVinoski commented May 20, 2023

Description

Hello everyone,

I had a similar error: "spawn /bin/sh ENOENT" and I solved it as follows:

I ran the command:

bash npm config list

image

I noticed that it had the directory /bin/sh set as the shell, which shouldn't be the case... Therefore, I deleted that directory.

Command:

npm config delete script-shell

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

7 participants