ElectronJS:npm错误!埃尔诺4294930435 [英] ElectronJS: npm ERR! errno 4294930435

查看:137
本文介绍了ElectronJS:npm错误!埃尔诺4294930435的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ElectronJS项目,我最终设法正确地进行了构建(构建时没有错误).但是当我尝试启动它时,我只会收到此错误:

I have this ElectronJS project that I finally managed to build correctly (no errors when building). But when I am trying to start it, I just get this error:

npm ERR! code ELIFECYCLE
npm ERR! errno 4294930435
npm ERR! movie-ex-gui@1.0.0 start: `electron dist/main.js`
npm ERR! Exit status 4294930435
npm ERR! 
npm ERR! Failed at the movie-ex-gui@1.0.0 start 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\Anoneemo\AppData\Roaming\npm-cache\_logs\2021-01-22T16_56_16_185Z-debug.log

我也无法理解 debug.log 文件.

但是,当我尝试使用 electron dist/main.js --enable-logging 而不是npm start脚本启动应用程序时,我在控制台中得到了这个: [16724:0122/180054.390:ERROR:crashpad_client_win.cc(808)]未连接.我试过删除 node_modules 文件夹,再次安装,验证缓存,重新启动计算机,以及几乎可以在google上挖掘的所有内容.

But when I try to launch the application with electron dist/main.js --enable-logging instead of the npm start script, I get this in the console: [16724:0122/180054.390:ERROR:crashpad_client_win.cc(808)] not connected. I have tried removing the node_modules folder, installing again, verifying the cache, restarting the computer and pretty much everything I could dig up on google.

有人知道这里可能出什么问题吗?在构建时出现错误之前,它运行良好.然后我在构建和修复错误,方法是简单地在我的webpack babel-loader中添加排除项.然后它构建良好,但根本不会启动.整个项目可以在这里找到: movie-ex .

Does anyone know what could be wrong here? It launched fine before I had the error when building. Then I got error when building and fixed that by simply adding an exclude to my webpack babel-loader. Then it builds fine, but wont startup at all. The whole project can be found here: movie-ex.

有任何线索吗?预先感谢!

Any clues anyone? Thanks in advance!

推荐答案

注意到我不使用webpack,将Electron从v8.1.0升级到v11.2.0时,我收到了完全相同的错误

Noting that I do not use webpack, I received the exact same error after upgrading Electron from v8.1.0 to v11.2.0

我的错误似乎是由于使用了"__dirname"当在电子"new BrowserWindow"中使用时,变量->图标"设置.

My error appeared to originate from the use of the "__dirname" variable when used in the Electron "new BrowserWindow" -> "icon" setting.

当您使用模块时,我怀疑它可能与"new BrowserWindow->"有关.webPreferences->nodeIntegration"和"contextIsolation"范围设置,因此您需要在"webpack.config.js"目录中设置 __ dirname:true 文件(参考: https://webpack.js.org/configuration/node/)

As you are using modules, I suspect it may have something to do with the "new BrowserWindow -> webPreferences -> nodeIntegration" and "contextIsolation" scope settings, thus your need to set __dirname: true in your "webpack.config.js" file (Ref: https://webpack.js.org/configuration/node/)

PS:我对更新后的Electron"nodeIntegration"电子书还不满和"contextIsolation"设置,因为这是我很长时间以来第一次今天早上才更新我的应用程序,并了解到Electron v12的更改/挂起的默认设置.

PS: I'm not full bottle on the updated Electron "nodeIntegration" and "contextIsolation" settings as I only updated my app this morning for the first time in a long time and learnt of the changed / pending default setting(s) of Electron v12.

更多信息可以在下面找到:

More information can be found below:

很有趣的是,我原来的图标"值是 icon:__dirname +'',.我在开发过程的初期就设置了此功能,后来却忘了将其指向正确的* .ico文件.

Funnily enough, my original "icon" value was icon: __dirname + '',. I had set this early on during development and subsequently forgot to point it to a proper *.ico file later on.

我刚刚创建了一个"icon.ico"文件并设置图标"值.

I just created an "icon.ico" file and set the "icon" value accordingly.

icon:__dirname +'/../../../icons/icon.ico'这似乎可行.

作为替代方案,我还尝试了以下操作(注释掉了"icon"行).

As an alternative, I also tried the following (with the "icon" line commented out).

win.setIcon(__ dirname +'/../../../icons/icon.ico'); 同样有效.

注意事项:重构路径->加入功能.

重要提示: 总而言之,我目前已设置 nodeIntegration:true .在升级到Electron v12之前,最好先解决这个问题.

Important: That all said, I currently have set nodeIntegration: true. Better sort this out before upgrading to Electron v12.

这篇关于ElectronJS:npm错误!埃尔诺4294930435的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆