electron 安装爬坑记录笔记

270 阅读1分钟

参考文章
www.cnblogs.com/zeosky-zhe/…

主要为, 在 .npmrc 文件中填入


ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/

默认npm i 报错404 。 必须手动设置 elctron

文件中设置后。 npm i可启用

报错类似于

npm ERR! command C:\windows\system32\cmd.exe /d /s /c node install.js
npm ERR! HTTPError: Response code 404 (Not Found)
npm ERR!     at Request._onResponseBase (C:\Users\hp\AppData\Roaming\nvm\v16.1.0\node_modules\electron\node_modules\got\dist\source\core\index.js:913:31)
npm ERR!     at Request._onResponse (C:\Users\hp\AppData\Roaming\nvm\v16.1.0\node_modules\electron\node_modules\got\dist\source\core\index.js:948:24)
npm ERR!     at ClientRequest.<anonymous> (C:\Users\hp\AppData\Roaming\nvm\v16.1.0\node_modules\electron\node_modules\got\dist\source\core\index.js:962:23)
npm ERR!     at Object.onceWrapper (node:events:472:26)
npm ERR!     at ClientRequest.emit (node:events:377:35)
npm ERR!     at ClientRequest.origin.emit (C:\Users\hp\AppData\Roaming\nvm\v16.1.0\node_modules\electron\node_modules\@szmarczak\http-timer\dist\source\index.js:43:20)
npm ERR!     at HTTPParser.parserOnIncomingClient (node:_http_client:621:27)
npm ERR!     at HTTPParser.parserOnHeadersComplete (node:_http_common:127:17)
npm ERR!     at TLSSocket.socketOnData (node:_http_client:487:22)
npm ERR!     at TLSSocket.emit (node:events:365:28)

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\hp\AppData\Local\npm-cache\_logs\2024-06-12T06_58_45_871Z-debug.log
PS D:\wnmp\caixun\ClientWin_bosc_FE-chinamobile\ClientWin_bosc_FE-chinamobile>