带有电子包装器的角度 5 [英] angular 5 with electron-packager
问题描述
我尝试使用 electron-packager 将我的电子项目构建到窗口应用程序,但出现此错误.
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 cent,我做了一个没有错误的包,但也避免了添加不必要的文件:
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
electron-packager 希望你已经运行了 angular 构建过程:
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屋!