Sanjan Das
Sanjan Das

Reputation: 75

`node : not found` when trying to `npm run dev`

I'm trying to run a Svelte example project on my Windows 10 system. I'm using Node v14.17.0 and npm v6.14.13. When I run npm run dev at the project level directory, I get the following error.

C:\...\my-svelte-project>npm run dev

> [email protected] dev C:\...\my-svelte-project
> rollup -c -w

/mnt/c/.../my-svelte-project/node_modules/.bin/rollup: 12: /mnt/c/.../my-svelte-project/node_modules/.bin/rollup: node: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file bash
npm ERR! errno ENOENT
npm ERR! [email protected] dev: `rollup -c -w`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\...\AppData\Roaming\npm-cache\_logs\2021-05-22T12_25_15_891Z-debug.log

I can't seem to figure out the error, and I've tried a range of suggestions available online. Has anyone come across this? I'm most confused with the node : not found prompt even though node is clearly installed and on the Path variable.

Additional info: I tried to run rollup -c -w, and this is the error log I get -

21 error code ELIFECYCLE
22 error syscall spawn bash
23 error file bash
24 error path bash
25 error errno -4058
26 error [email protected] start: `sirv public --no-clear`
26 error spawn bash ENOENT
27 error Failed at the [email protected] start script.
27 error This is probably not a problem with npm. There is likely additional logging output above.
28 verbose exit [ -4058, true ]

Upvotes: 2

Views: 2176

Answers (1)

Llamrei
Llamrei

Reputation: 86

If you have tried reinstalling node modules and/or node overall:

The error seems to be with a lack of access to/from bash to the sirv command - which we can deduce from ENOENT (short for Error NO Entry). If you look at npm settings docs we can see how to configure which shell npm tries to use in running its scripts. I suspect if you ran npm config get script-shell you would get bash - which in the case of windows is referring to git bash specifically.

On my system with a working svelte example I have this set to null (which I did not set manually and weirdly isn't one of the options in the docs) so you can try to set it with npm config set script-shell=null or if that doesn't save your bacon try npm config set script-shell=cmd.exe.

Upvotes: 7

Related Questions