在树莓派3上安装Electronic JS时出现问题

时间:2019-11-15 13:21:14

标签: node.js electron raspberry-pi3

当我使用以下命令安装电子js时,我在raspberry pi 3上安装了节点js:

sudo npm install -g electron --unsafe-perm=true --allow-root

我得到以下输出:

/usr/local/bin/electron -> /usr/local/lib/node_modules/electron/cli.js

> core-js@3.4.1 postinstall /usr/local/lib/node_modules/electron/node_modules/core-js
> node postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> electron@7.1.1 postinstall /usr/local/lib/node_modules/electron
> node install.js

(node:11878) UnhandledPromiseRejectionWarning: HTTPError: Response code 404 (Not Found)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/electron/node_modules/got/source/as-stream.js:35:24)
    at EventEmitter.emit (events.js:210:5)
    at module.exports (/usr/local/lib/node_modules/electron/node_modules/got/source/get-response.js:22:10)
    at ClientRequest.handleResponse (/usr/local/lib/node_modules/electron/node_modules/got/source/request-as-event-emitter.js:155:5)
    at Object.onceWrapper (events.js:300:26)
    at ClientRequest.emit (events.js:215:7)
    at ClientRequest.origin.emit (/usr/local/lib/node_modules/electron/node_modules/@szmarczak/http-timer/source/index.js:37:11)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:115:17)
    at TLSSocket.socketOnData (_http_client.js:456:22)
(node:11878) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11878) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
+ electron@7.1.1
added 86 packages from 90 contributors in 39.202s

如何纠正此问题。

3 个答案:

答案 0 :(得分:2)

为解决此问题,我在项目根目录中创建了一个“ .npmrc”文件并添加:

arch=armv7l

您可以从以下位置获得拱门:

uname -m

答案 1 :(得分:1)

尝试安装旧版电子。

npm install electron@6.1.4

答案 2 :(得分:0)

可能您可以下载电子文件(和其他库)作为存档文件,复制到raspberry并安装。

  1. 下载
npm pack electron
  1. 复制电子7.1.1tgz

  2. 安装

npm install ./electron-7.1.1.tgz