[英]Uncaught Error: spawn .\node.exe ENOENT
I have a nodejs app being run through electron 我有一个通过电子运行的nodejs应用程序
https://github.com/frankhale/electron-with-express 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: 使用
npm run dist:win32
将应用程序打包为可执行文件后,我在控制台中遇到了以下问题:
events.js:160 Uncaught Error: spawn .\node.exe ENOENT
Below is how my devDependencies looks like 以下是我的devDependencies的样子
"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. 当我使用npm start运行应用程序时它工作正常,并且没有运行错误。 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'.
使用'fix-path'。
https://www.npmjs.com/package/fix-path https://www.npmjs.com/package/fix-path
npm install --save fix-path
Then, use it like this before your spawn : 然后,在你的产卵之前使用它:
// Use to access 'spawn' when the app is packaged
const fixPath = require('fix-path')();
// or
const fixPath = require('fix-path');
fixPath();
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.
我使用了您的解决方案和此解决方法的组合来获取从打包的.app内部生成的进程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.