如何分发使用电子构建器构建的构建可执行文件 [英] How to distribute a built executable constructed using electron-builder
问题描述
我最近使用电子构建器打包了一个电子应用程序:
I have recently packaged an electron app using electron-builder:
myProject/
├── package.json
├── app/
└── release/
所有文件由electronic-builder创建的文件放置在发布目录中。可执行文件在我的本地计算机上运行良好,所有功能都通过打包的应用程序提供。
All files created by electron-builder are place in the release directory. The executable works fine on my local machine, with all features present through the packaged app.
但是,一旦我将应用程序移动到另一台计算机上,只有某些功能可用。显然,不包含app /子目录中的功能。
However, once I move the application to another machine only some features are available. Noticeably features within subdirectories in app/ are not included.
例如,此处是app /目录的片段:
For example here a snippet of the app/ directory:
app/
├── app.html
├── index.js
├── components/
└── other files and folders
components /中的.js / .html文件添加的功能不是当我将应用程序移至另一台计算机时显示。我尝试过只移动可执行文件以及整个release /目录,都没有包括app.html中没有的其他功能。
Features added from .js/.html files within components/ are not present when I move the app to another machine. I have tried both moving just the executable as well as the whole release/ directory, neither includes additional features beyond what is included in app.html.
更新
它的确看起来像其他任何机器都根本不读取其中包含的项目
It does indeed look like any other machine simply doesn't read items contained in
<script></script>
在我的app.html文件中
In my app.html file
我需要在另一台计算机上进行一些外部安装以使此可执行文件运行
Would there be some outside installation I need to do on another machine to get this executable running
推荐答案
发现了问题,
它涉及到我对两个 package.json
结构的使用
It involved my usage of a two package.json
structure
我的构建
的依赖项
和 devDependencies
都位于 root / package.json
,其中依赖项需要移至 app / package.json
文件
Both dependencies
and devDependencies
of my build
were located in the root/package.json
, where dependencies needed to be moved to the app/package.json
file
这篇关于如何分发使用电子构建器构建的构建可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!