electron package can not find module xml2json

本文介绍了使用Electron打包应用程序时遇到的问题:无法找到xml2json模块。问题的原因在于打包过程中默认排除了devDependencies中的node_modules文件夹。文章提供了解决方法,即通过添加--no-prune标志来确保所有依赖项都被包含在最终的应用程序包中。

问题

electron 打包好的应用找不到xml2json

但是开发环境npm start 运行正常

定位

node_modules没有包含在打的包中,

解决办法

--no-prune

Be careful not to include node_modules you don't want into your final app. If you put them in the devDependencies section of package.json, by default none of the modules related to those dependencies will be copied in the app bundles. (This behavior can be turned off with the --no-prune flag.) In addition, folders like .git and node_modules/.bin will be ignored by default. You can use --ignore to ignore files and folders via a regular expression (not a glob pattern). Examples include --ignore=.gitignore or --ignore=".git(ignore|modules)".

electron-packager ./ --platform linux --arch=x64 --overwrite --no-prune

转载于:https://www.cnblogs.com/mayidudu/p/5865267.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值