【问题标题】:Unable to build with electron-packager within electron-forge无法在电子锻造中使用电子包装器构建
【发布时间】:2017-12-27 00:10:20
【问题描述】:

我用电子锻造创建了一个默认项目。当我尝试使用命令electron-forge 打包我的项目时,进程退出并出现以下错误。

我做错了什么?我按照指示前往electron-forge 发球台。

$ electron-forge package
✔ Checking your system
✔ Preparing to Package Application for arch: x64
✔ Compiling Application
✔ Preparing native dependencies
⠦ Packaging Application
An unhandled rejection has occurred inside Forge:
Command failed: npm prune --production
npm WARN electron-example@1.0.0 No repository field.

npm ERR! May not delete: /tmp/electron-packager/linux-x64/electron-example-linux-x64/resources/app/node_modules/.bin

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/maxchehab/.npm/_logs/2017-07-21T04_40_37_618Z-debug.log

Error: Command failed: npm prune --production
npm WARN electron-example@1.0.0 No repository field.

npm ERR! May not delete: /tmp/electron-packager/linux-x64/electron-example-linux-x64/resources/app/node_modules/.bin

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/maxchehab/.npm/_logs/2017-07-21T04_40_37_618Z-debug.log

    at ChildProcess.exithandler (child_process.js:270:12)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:921:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

感谢您的宝贵时间。

【问题讨论】:

    标签: node.js npm electron electron-packager electron-forge


    【解决方案1】:

    问题已在npm的后续版本中解决,请考虑升级到最新的v(>5.4.2)而不是降级到5.2

    npm i -g npm
    

    【讨论】:

      【解决方案2】:

      看起来最新版本的 npm 为电子制作过程引入了一个错误。此处正在跟踪问题。 Github Issue

      尝试此解决方法以获得可能的修复(未经测试):

      rm -rf node_modules
      npm install --production --ignore-scripts
      npm install --no-save electron-rebuild --ignore-scripts
      node_modules/.bin/electron-rebuild
      npm remove electron-rebuild --ignore-scripts
      

      或者将你的 npm 降级到低于 5.3 的版本(经过测试,可以工作)。

      npm i -g npm@5.2
      

      【讨论】:

      • 解决了我的问题。谢谢!
      • 很高兴它帮助了你。
      猜你喜欢
      • 1970-01-01
      • 2020-04-08
      • 2018-02-06
      • 2019-07-15
      • 2020-10-10
      • 2018-05-15
      • 2018-03-10
      • 2021-06-28
      • 2020-01-28
      相关资源
      最近更新 更多