electron 由于错误,无法在MacOS上全局安装电子

tjrkku2a  于 2022-12-08  发布在  Electron
关注(0)|答案(1)|浏览(278)

我在尝试全局安装electron时遇到错误,我不确定原因。

npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/electron
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! HTTPError: Response code 404 (Not Found) for https://github.com/electron/electron/releases/download/v19.0.9/electron-v19.0.9-darwin-ia32.zip
npm ERR!     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/electron/node_modules/got/source/as-stream.js:35:24)
npm ERR!     at EventEmitter.emit (node:events:390:28)
npm ERR!     at module.exports (/usr/local/lib/node_modules/electron/node_modules/got/source/get-response.js:22:10)
npm ERR!     at ClientRequest.handleResponse (/usr/local/lib/node_modules/electron/node_modules/got/source/request-as-event-emitter.js:155:5)
npm ERR!     at Object.onceWrapper (node:events:510:26)
npm ERR!     at ClientRequest.emit (node:events:402:35)
npm ERR!     at ClientRequest.origin.emit (/usr/local/lib/node_modules/electron/node_modules/@szmarczak/http-timer/source/index.js:37:11)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:623:27)
npm ERR!     at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
npm ERR!     at TLSSocket.socketOnData (node:_http_client:487:22)

npm ERR! A complete log of this run can be found in:
8ftvxx2r

8ftvxx2r1#

不知什么原因,你的npm试图用ia32架构安装Electron,结果导致一个可下载的zip文件不是由Electron维护者提供的。这就是为什么你会得到一个404 HTTP状态码。
回到电子的releases page,我似乎找不到任何darwin-ia32资产(达尔文是macOS的代码名称)。
您可以尝试使用

npm install --arch=x64 electron

如Electron的安装指南中所建议的。

相关问题