I have a nodejs app being run through electron
https://github.com/frankhale/electron-with-express
After packaging the app as an executable using npm run dist:win32
, I ran into the following issue in console:
events.js:160 Uncaught Error: spawn .\node.exe ENOENT
Below is how my devDependencies looks like
"devDependencies": {
"electron-builder": "^5.26.0",
"electron-prebuilt": "^1.3.3",
"electron-rebuild": "^1.2.0"
}
When i run the app using npm start it works fine, and no error is run. Its when the app is run as an executable i see the error on console.
I had the same problem, after many try/search, I found a solution. Use 'fix-path'.
https://www.npmjs.com/package/fix-path
npm install --save fix-path
Then, use it like this before your spawn :
low rep here or else I would just comment. Thanks for sharing your repo. I used a combo of your solution and this workaround to get processes spawned from inside packaged .app.