javascript 电子不能在树莓派上工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31927337/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 14:35:53  来源:igfitidea点击:

Electron not working on Raspberry Pi

javascriptnode.jsnpmraspberry-pielectron

提问by stoeffn

At the moment, I am developing a "kiosk" application for my Raspberry Pi. I decided to use Electronas it offers the key feature I need: Combining a web based UI with direct system an I/O access via node.js.

目前,我正在为我的 Raspberry Pi 开发一个“信息亭”应用程序。我决定使用Electron,因为它提供了我需要的关键功能:将基于 Web 的 UI 与直接系统相结合,通过 node.js 进行 I/O 访问。

However, Electron refuses to run on my Raspberry Pi whereas it works just fine on the computer I am using for development. Nothing happens after issuing electron .in the terminal, the program just exits without showing a window or any errors in the command line. Any clues? I couldn't find any on the web so far. I installed Electron via npm install electron-prebuilt -g, which downloaded and installed the latest ARM-version.

然而,Electron 拒绝在我的 Raspberry Pi 上运行,而它在我用于开发的计算机上运行良好。electron .在终端中发出后没有任何反应,程序只是退出而不显示窗口或命令行中的任何错误。有什么线索吗?到目前为止,我在网上找不到任何内容。我通过 安装了 Electron npm install electron-prebuilt -g,它下载并安装了最新的 ARM 版本。

If this is an unresolvable compatibility problem: Are there any good alternatives for Electron?

如果这是一个无法解决的兼容性问题:Electron 有什么好的替代品吗?

Thanks in advance!

提前致谢!

回答by Marcelo Lazaroni

Unfortunately the reason for that error is that Electron currently does not support ARM devices. We will have to wait until it is implemented

不幸的是,该错误的原因是 Electron 当前不支持 ARM 设备。我们将不得不等到它实施

See this issue https://github.com/atom/electron/issues/1702

看到这个问题https://github.com/atom/electron/issues/1702

-- Update

- 更新

As noted by @skeggse, Electron now does support ARM.

正如@skeggse 所指出的,Electron 现在确实支持 ARM。

  • 1 Get the dependecies going apt-get install libgtk2.0-0 libnotify4 libgconf2-4 libnss3 node npm

  • 2 Download the latest armrelease called electron-...-linux-arm.zipfrom here

  • 3 unzip electron-...-linux-arm.zip

  • 4 go inside the folder and double click the file named electron

  • 5 Have fun!

  • 1 获取依赖 apt-get install libgtk2.0-0 libnotify4 libgconf2-4 libnss3 node npm

  • 2从此处下载名为electron-...-linux-arm.zip的最新arm版本

  • 3 unzip electron-...-linux-arm.zip

  • 4 进入文件夹并双击名为电子的文件

  • 5 玩得开心!

回答by GAMELASTER

Connect to Raspberry SSH as user pi, and execute this:

以用户pi连接到 Raspberry SSH ,并执行以下命令:

# Clone this repository
git clone https://github.com/electron/electron-quick-start
# Go into the repository
cd electron-quick-start
# Install dependencies
npm install
# Set display
export DISPLAY=:0
# Run the app
npm start

回答by user650881

Depending on which Raspberry Pi you have it may be an incompatible binary. The electron prebuilt binaries, I believe, target armv7-hf. Try building electron from source. The instructions can be found here https://github.com/atom/electron/blob/master/docs/development/build-instructions-linux.md

根据您拥有的 Raspberry Pi,它可能是不兼容的二进制文件。我相信电子预建二进制文件针对 armv7-hf。尝试从源头构建电子。说明可以在这里找到https://github.com/atom/electron/blob/master/docs/development/build-instructions-linux.md

Note that if you are interested in using hardware float support (at least prior to RPiB+) you might want to run Raspbian or another port with hard-float support. (ref)

请注意,如果您对使用硬件浮点支持(至少在 RPiB+ 之前)感兴趣,您可能希望运行 Raspbian 或其他具有硬浮点支持的端口。(参考

回答by pherris

This is a pretty broad question. You could try stopping on the first line of your application with:

这是一个相当广泛的问题。您可以尝试在应用程序的第一行停止:

electron --debug-brk=5858 .

This would help you determine whether it's an electron issue or an issue with your app.

这将帮助您确定是电子问题还是您的应用程序问题。

http://electron.atom.io/docs/v0.30.0/tutorial/debugging-main-process/

http://electron.atom.io/docs/v0.30.0/tutorial/debugging-main-process/