Skip to content
Advertisement

Error: spawn npm ENOENT

I have an JS app. It works good on linux but in windows 10 I am getting an error.

JavaScript

and the code which is incorrect is this

JavaScript

I found the reason of this error in github I guess the problem is spawn nodejs spawn Doc which have didn’t work correctly in windows. But I don’t know how to modify this snippet of code to make it work. Can someone help me ?

Advertisement

Answer

Just changed this line

JavaScript

to this line

JavaScript

Which is checking the operating system if ti’s windows it runs npm.cmd if it’s linux just npm

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement