使用带有电子编译和电子松鼠启动的电子锻造初始化电子应用程序时出错

分享于2023年06月29日 electron electron-forge node.js npm 问答
【问题标题】:Error when initialising electron App using electron-forge with electron-compile and electron-squirrel-startup使用带有电子编译和电子松鼠启动的电子锻造初始化电子应用程序时出错
【发布时间】:2023-06-17 02:24:01
【问题描述】:

我通过使用 GitHub 按需培训开始学习电子版。当我执行以下命令时。系统抛出错误。

electron % electron-forge init electron-app
⚠ Could not check Yarn version "0.32
", assuming incompatible
⚠ You are using Yarn, but not a known good version.
The known versions that work with Electron Forge are: 0.23.3 || 0.24.6 || >= 1.0.0 || 0.27.5
✔ Checking your system
? WARNING: The specified path: "/home/anoobbava/electron/electron-app" 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-compile","electron-squirrel-startup"]

With output: Exited with status 1
Error: Failed to install modules: ["electron-compile","electron-squirrel-startup"]

With output: Exited with status 1
    at /home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/dist/util/install-dependencies.js:55:13
    at Generator.throw ()
    at Generator.tryCatcher (/home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseRejected (/home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/generators.js:107:10)
    at Promise._settlePromise (/home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:576:26)
    at Promise._settlePromise0 (/home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:690:18)
    at _drainQueueStep (/home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/anoobbava/.nvm/versions/node/v9.9.0/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)

其他详情如下, 操作系统:Ubuntu 18.04 节点:v9.9.0 NPM:6.4.1 我已经更新了我的 NPM 版本,但问题仍然存在。另外,这种情况下需要安装yarn吗?


【解决方案1】:

我有一个类似的问题,它最终与纱线版本有关。我通过这种方式安装纱线来修复它:

sudo npm install --global yarn 

【讨论】: