Electron-froge安装卡死在Installing NPM Dependencies
作者:互联网
C:\Users\chais>electron-forge init project1
√ Checking your system
? WARNING: The specified path: "C:\Users\chais\project1" is not empty, do you wish to continue? Yes
√ Initializing Project Directory
√ Initializing Git Repository
√ Copying Starter Files
√ Initializing NPM Module
× Installing NPM Dependencies
An unhandled error has occurred inside Forge:
Failed to install modules: ["electron-prebuilt-compile"]
With output: Exited with status 1
Error: Failed to install modules: ["electron-prebuilt-compile"]
With output: Exited with status 1
at C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\dist\util\install-dependencies.js:55:13
at Generator.throw (<anonymous>)
at Generator.tryCatcher (C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\util.js:16:23)
at PromiseSpawn._promiseRejected (C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\generators.js:107:10)
at Promise._settlePromise (C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\promise.js:611:26)
at Promise._settlePromise0 (C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\promise.js:725:18)
at _drainQueueStep (C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\chais\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (node:internal/timers:464:21)
解决办法:
配置ELECTRON_MIRROR为国内源
解决的方法就是在~/.npmrc里做如下设置,
registry=https://registry.npm.taobao.org/
electron_mirror=https://npm.taobao.org/mirrors/electron/
如果您使用的是yarn,请将 ~/.npmrc里添加以下配置
ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
标签:NPM,node,electron,modules,Installing,js,Electron,npm,chais 来源: https://blog.csdn.net/chaishen10000/article/details/121873007