问题
I have recently packaged an electron app using electron-builder:
myProject/
├── package.json
├── app/
└── release/
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.
However, once I move the application to another machine only some features are available. Noticeably features within subdirectories in app/ are not included.
For example here a snippet of the app/ directory:
app/
├── app.html
├── index.js
├── components/
└── other files and folders
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.
Update
It does indeed look like any other machine simply doesn't read items contained in
<script></script>
In my app.html file
Would there be some outside installation I need to do on another machine to get this executable running
回答1:
Found the issue,
It involved my usage of a two package.json
structure
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
来源:https://stackoverflow.com/questions/61806902/how-to-distribute-a-built-executable-constructed-using-electron-builder