我使用Electron js开发了一个桌面应用程序。这是我在MacOS和Windows上开发的。我在复制main.js、main.html和renderer.js。当我在更换我使用的电脑时
npm rebuild然后,我使用以下命令运行项目
npm start我还在Ubuntu上测试了它。它也是有效的。然而,当我在装有Raspian OS的Rasspberry Pi 3 B+上尝试它时,我无法运行它。错误如下所示。提前谢谢你们。
> ls@1.0.0 start /home/pi/Desktop/deneme
> electron .
/home/pi/Desktop/deneme/node_modules/electron/index.js:14
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
^
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at getElectronPath (/home/pi/Desktop/deneme/node_modules/electron/index.js:14:11)
at Object.<anonymous> (/home/pi/Desktop/deneme/node_modules/electron/index.js:18:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)
at Module.load (internal/modules/cjs/loader.js:914:32)
at Function.Module._load (internal/modules/cjs/loader.js:822:14)
at Module.require (internal/modules/cjs/loader.js:956:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/pi/Desktop/deneme/node_modules/electron/cli.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ls@1.0.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ls@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! /home/pi/.npm/_logs/2019-11-13T12_15_05_388Z-debug.log我尝试了很多次,删除并重新安装节点模块。我还尝试了不同的节点版本。下面是我的版本:
node -v
V13.1.0
npm -v
V6.12.1我甚至不能运行https://github.com/electron/electron-quick-start。我想问题出在我的操作系统上。
发布于 2019-11-14 19:26:55
较新版本的Electron显然与Raspbian不兼容。因此,我已经安装了Electron 3.0.13,这是我发现正在工作的最后一个版本。
要更改电子版本,请删除node_modules文件夹和package-lock.js,打开package.json并按如下所示进行修改:
"electron": "3.0.13" 然后运行
npm install下载并安装正确版本的Electron,该应用程序将在Raspbian上运行良好。
https://stackoverflow.com/questions/58837135
复制相似问题