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

/bin/sh: node: command not found #845

Closed
KaiHufenbach opened this issue Mar 9, 2022 · 1 comment · Fixed by #874 or #941
Closed

/bin/sh: node: command not found #845

KaiHufenbach opened this issue Mar 9, 2022 · 1 comment · Fixed by #874 or #941

Comments

@KaiHufenbach
Copy link

Environment

  1. vscode-jest version: 4.2.1
  2. node -v: 17.5.0
  3. npm -v: 8.4.1
  4. npm ls jest: jest@27.5.1
  5. your vscode-jest settings if customized:
    • jest.jestCommandLine? node --experimental-vm-modules node_modules/jest/bin/jest.js
    • jest.autoRun? { "watch": false, "onSave": "", "onStartup": [] } <==== i would love to use any other option, but watch runs into 100% CPU usage issue
    • anything else that you think might be relevant? same config on another mac works quite well.
  6. Operating system: mac OS 11.6.4

Prerequisite

  • are you able to run jest test from the command line? ✅

  • how do you run your tests from the command line? npm run test

   "scripts": {
       "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
     }

Steps to Reproduce

in an empty Project with package.json

 {
  "type": "module",
  "scripts": {
    "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
  },
  "devDependencies": {
    "jest": "^27.4.7",
    "@types/jest": "^27.4.0"
  }
}

  • create a simple foo.test.js
  • restart VSCode to get test tube
  • at start it says:

not-test onProcessExit: process exit with code=127, signal=undefined

  • start the test with play button:
all-tests-1 is scheduled
/bin/sh: node: command not found

Relevant Debug Info

on Start, with jest.debugMode: true it prints

not-test-0 is scheduled
Jest Session Started
not-test onProcessExit: process exit with code=127, signal=undefined
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting

I would expect the jest plugin to use another shell config (bash?!) but I do not have any clue where to look. As tests from the terminal within vsCode work. I tested both zsh and bash.

@connectdotz
Copy link
Collaborator

/bin/sh: node: command not found

is a clear indicator that the runtime env is not set up properly, see here for explanation and suggestions (see "how to fix this issue?" section).

Please let me know if you still see this problem after starting vscode from a terminal window as suggested above.

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