electron-packager打包实力应用时出现的错误

 执行

yarn add electron-packager --save-dev

报错:

error [email protected]: The engine "node" is incompatible with this module. Expected version ">= 14.17.5". Got "14.3.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

原因就是当前用的node版本不兼容,期望版本>=14.17.5。

解决:

运行 

yarn config set ignore-engines true

效果如图:

 其实就是设置 ignore-engines 为true,忽略了引擎检查。

再次运行yarn add electron-packager --save-dev,成功:

 成功后配置package.json 文件,在scripts中增加:

扫描二维码关注公众号,回复: 15530641 查看本文章
"packager": "electron-packager ./ testapp --win --out ./outputs"

之后运行:npm run packager 

又报错:

 貌似上面的ignore并不管用,无语,只能升级node版本,windows升级node版本通过下载新的包覆盖安装在原文件。

更新之后再次执行 打包命令,成功后在项目文件夹内出现outputs文件夹下:

路漫漫其修远兮,吾将上下而求索!

猜你喜欢

转载自blog.csdn.net/weixin_38817361/article/details/130233638