NodeJs ENOENT error on all commands regardless of some working

47 views Asked by At

Nodejs throwing error ENOENT on all commands. It is acting as though it is uninstalled but it allows some commands. I can run --version, install dependencies, help. For example;

npm --version 'CALL "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command, operable program or batch file. 10.1.0

Full error when trying to run dev

32 verbose stack Error: spawn C:\Program Files\nodejs ENOENT
32 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:286:19)
32 verbose stack     at onErrorNT (node:internal/child_process:484:16)
32 verbose stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
33 verbose pkgid [email protected]
34 verbose cwd D:\projectfolder
35 verbose Windows_NT 10.0.19043
36 verbose node v20.9.0
37 verbose npm  v10.1.0
38 error code ENOENT
39 error syscall spawn C:\Program Files\nodejs
40 error path D:\projectfolder
41 error errno -4058
42 error enoent spawn C:\Program Files\nodejs ENOENT
43 error enoent This is related to npm not being able to find a file.
43 error enoent
44 verbose exit -4058

Fixes that haven't worked Change the path to the install folder Change path to System32 Restart vscode Restart pc Yarn is incompatible with this project so cannot switch Installing different versions of npm

One of the solutions I found was formatting the pc but that is not possible for me.

These are some other questions on this but none of those answers have worked for me: All npm commands giving same error (ENOENT)

npm ERR! code ENOENT and npm ERR! syscall spawn C:\Program Files\nodejs\node.exe

https://github.com/nodejs/node-gyp/issues/2366

I had initially thought it was a pathing issue but I have changed the path multipul times and have the same errors.

0

There are 0 answers