0

Every time I run any npx command it gives me an error with the following message:

npx create-expo-app myApp
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Name\Documents\Programming\ReactNative
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

I tried clearing the npm cache, but that didn't helped.

  • This looks like your NPM thinks your shell environment is bash, which is probably not correct as the path looks like you're on a Windows machine. Check out this answer https://stackoverflow.com/a/74647007/507793 for more details. – Matthew Apr 19 '23 at 17:35
  • 1
    Yes, that worked! Thank you very much. I have been looking for a solution for hours. :) @Matthew Do you want to add your comment as a Answer? Then I can accept it! :] – Mondmarmelade Apr 19 '23 at 17:42

1 Answers1

0

From the error, it looks like npm thinks your shell is bash, hence the npm ERR! enoent spawn bash ENOENT error. From the "path" in the error message, I'll assume you're working in a Windows environment, where bash is likely not available.

You can see what your shell is by executing npm config ls -l and looking for the script-shell value.

See answer NPM - ENOENT syscall spawn bash (this is related to npm not being able to find a file) for more details.

Matthew
  • 24,703
  • 9
  • 76
  • 110