简体   繁体   English

无法在电子锻造中使用电子封装器构建

[英]Unable to build with electron-packager within electron-forge

I have created a default project with electron-forge. 我用电子伪造创建了一个默认项目。 When I try to package my project with the command electron-forge , the process exits with the following error. 当我尝试使用命令electron-forge打包我的项目时,进程退出时出现以下错误。

What am I doing wrong? 我究竟做错了什么? I followed the instructions to a tee at 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)

Thank you for your time. 感谢您的时间。

It looks like the latest version of npm has introduced a bug for the electron make process. 看起来npm的最新版本引入了电子制作过程的错误。 Issue is being tracked here. 这里正在跟踪问题。 Github Issue Github问题

Try this workaround for a possible fix(untested): 尝试此解决方法以获得可能的修复(未经测试):

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

Or downgrade your npm to a version less than 5.3(tested, works). 或者将你的npm降级到低于5.3的版本(测试,工作)。

npm i -g npm@5.2

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

npm i -g npm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM