Windows 11 - npm ERR! errno -4058 - code ENOENT bash

Viewed 142

Got this very annoying NPM issue out of nowhere, though I must say I had a few weeks break from playing with my project.

Actual version of core-js.
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\User1\Documents\project11\node_modules\**@angular\cli**
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

This npm ERR! errno -4058 seems to be rather common issue, but I've found no success and am getting a bit worried, I've tried all possible solutions I've found online (below)

  1. Delete package-lock + node modules + npm cache and then run npm install
  2. Use yarn instead of NPM (installation succeeds but can't run project)
  3. Reinstall node and npm completely
  4. Test with different (newest) npm & node versions
  5. Test building only production version
  6. Restart computer
  7. Close all vscode applications etc. that could use npm
  8. Run cmd as admin
  9. Check windows defender if it could block npm
  10. Make sure system32 is correctly set in env. variables

Hox, the erro says angular-cli, but if I somehow manage to get through that, it will just complain about the next library

Edit: Workaround for me seems to be to run npm in git-bash For some reason I can't use powershell nor CMD anymore to run NPM, but that's not a big issue.

1 Answers

Funny. Before I posted this question, I already had spent well over 5 hours testing everything I found online. Immediately after posting this question, I, just for the sake of it, tested running npm install in "git-bash".

And.. it worked, so if somebody else is having issues with this, try running npm install in git bash https://gitforwindows.org/ instead

And of course you can try the things I tried above

Related