带电子封装的角度为5 [英] angular 5 with electron-packager
问题描述
我尝试使用electronic-packager将我的电子项目构建到window app,但是出现此错误.
I try to build my electron project to window app by using electron-packager but I get this error.
无法从"/var/www/windowapp/electron-angular-project/node_modules/@ angular-devkit/core/node_modules/chokidar"中找到模块"fsevents"
Failed to locate module "fsevents" from "/var/www/windowapp/electron-angular-project/node_modules/@angular-devkit/core/node_modules/chokidar"
This normally means that either you have deleted this package already somehow (check your ignore settings if using electron-packager). Or your module installation failed.
任何人都知道如何解决它以及发生了什么事?
Anyone know how to solve it and what happened to this?
推荐答案
在这里,我花了2美分,做了一个可以正常工作的程序包,没有错误,但也避免了添加不必要的文件:
Here my 2 cent, I did a package that works without the error, but also avoids to add unnecessary files:
electron-packager . --no-prune --ignore=/node_modules --ignore=/e2e --ignore=/src
电子包装机希望您已经运行了角度构建过程:
The electron-packager expect that you have already run run the angular build process:
ng build --prod
您可以将此脚本添加到 package.json
:
You can add this script in the package.json
:
"electron-package": "ng build --prod && electron-packager . --no-prune --ignore=/node_modules --ignore=/e2e --ignore=/src --overwrite"
然后运行:
npm run electron-package
这篇关于带电子封装的角度为5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!