未捕获错误:生成.\\\<br/>ode.exe ENOENT [英] Uncaught Error: spawn .\node.exe ENOENT
问题描述
我有一个通过电子运行的nodejs应用程序
I have a nodejs app being run through electron
https://github.com/frankhale/electron-with-express
使用 npm run dist:win32
,我在控制台遇到了以下问题:
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
以下是我的devDependencies看起来像
Below is how my devDependencies looks like
"devDependencies": {
"electron-builder": "^5.26.0",
"electron-prebuilt": "^1.3.3",
"electron-rebuild": "^1.2.0"
}
当我使用npm开始运行应用程序,它的工作正常,没有错误运行。当应用程序作为可执行文件运行时,我会看到控制台上的错误。
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.
推荐答案
我有同样的问题,经过多次尝试/搜索,我找到了一个解决方案。使用'fix-path'。
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 :
// Use to access 'spawn' when the app is packaged
const fixPath = require('fix-path')();
// or
const fixPath = require('fix-path');
fixPath();
这篇关于未捕获错误:生成.\\\<br/>ode.exe ENOENT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!