Open afabri73 opened 3 months ago
谢谢你分享的问题,这个打包后找不到第三方包依赖的问题也是之前困扰了我很久很久的问题。 Thank you for sharing the problem. This problem of not being able to find third-party package dependencies after packaging is also a problem that has troubled me for a long time.
首先,请确认这个仓库直接克隆到本地后,不做任何改动也是可以成功打包且打包后是可运行的,以此来排除版本和环境问题。 First, please confirm that after cloning this repository directly to the local computer, it can be packaged successfully without any changes and can be run after packaging, so as to rule out version and environment problems.
然后,需要注意的是,angular 所需要的第三方依赖应该在根目录下的package.json文件中添加。app目录下的package.json文件是用来添加主进程(即electron)所需要的依赖的。 Then, it should be noted that the third-party dependencies required by angular should be added in the package.json file in the root directory. The package.json file in the app directory is used to add the dependencies required by the main process (i.e. electron). 如果对应依赖添加的位置不对,就会出现打包后找不到模块的错误。 If the corresponding dependency is added to the wrong location, an error will occur that the module cannot be found after packaging.
关于想要创建安装文件的问题,我想这应该是打包工具使用的相关内容,印象中我曾经在electron-build官方网站上查到过如何配置去打包成安装文件,但是当时的项目并没有这个需求,所以并没有将它实践,以至于这里没能将这个内容包含进去,我很抱歉。但我认为你可以从electron-build官方网站找到这个问题的解决办法。 Regarding the issue of wanting to create installation files, I think this should be related to the use of packaging tools. I remember that I once found how to configure to package into installation files on the electron-build official website, but the project at that time did not have this requirement, so I did not put it into practice, so I was not able to include this content here. I am sorry. But I think you can find a solution to this problem from the electron-build official website.
新的安装会覆盖数据库这个问题我之前确实没有考虑过,刚刚我在本地做了测试,发现确实在重新打包后之前的数据都会被清空,这是个棘手的且需要解决的问题。 I had never considered the issue that the new installation would overwrite the database. I just tested it locally and found that all previous data would be cleared after repackaging. This is a tricky problem that needs to be solved.
最后,感谢你的使用和收藏,感谢你分享的问题!希望我能够帮助到你。 Finally, thank you for your use and collection, and thank you for sharing your questions! I hope I can help you.
@afabri73 你好 就找不到 ../../src/app/shared/functions/sharedfunctions.globals 模块的问题,有一个并不理想的方法就是把这个文件放到主进程的app文件夹,然后在相关的文件(应该是login.repository)内修改引用路径。 因为主进程app以外的文件似乎无法直接被引用到。希望能解决问题。
Hi, thank you for share the code. Based on your project, I have created my custom app and all works perfect, if I use it with VS Code.
But if I try to package the app (with command npm run electron:build as you suggest in the infos) to test the distribution, when I run the exe file I receive the following error:
I tried also to package with electron-forge but when I run the app, It doesn't find the index.html file. I also saw that with command npm run electron:build it build with target=portable but I would to create a setup file to install it.
Can you help me to understand how can correctly setup and package the app for distribution? The configuration files (package.json, angular.json, electron-builder.json are the same as your project)
A last question...when I'll install for the first time the app, I think that it create also a new db file sqlite3. When I'll must update/upgrade the app, how I can sure that the new installation doesn't overwright the db?
Thank you in advance for the support