I have problem with project(https://github.com/Gordienko-RU/plant-log), there are angular bundle in dist folder and electron main file into electron folder, but after packaging with electron-builder, application doesn't run.
I guess there are some problems with my config in to package.json
Ok, I had a similar issue with electron-packager. I tried your package.json and did a "npm install". To me it looks like that your build does include native addons (*.node).
In electron-packager the solution was to add the asar unpack option. You are using electron-builder. Therefore you should look at this thread: https://github.com/electron-userland/electron-builder/issues/390 . Maybe you need to specify the modules by hand, like:
"asar": true,
"asarUnpack": [
"../node_modules/uws"
]
Related
I have deploy my electron app with "electron-packager", but i see that the electron-packager include always "resources" folder which has asar file and app folder with all sources file of my app... how I can deploy without including including "resources" folder so user can not see my codes?
I trid to deleted the "resources" folder, but my app not opening.. and I see some third party app used electron-packager but "resources" folder not included and it's work fine. How they did that please, any suggestion is welcome?
Here is code I have used:
npx electron-packager . electron-tutorial-app --overwrite --no-asar --platform=win32 --arch=x64
Thanks.
Electron packager has packaged my app.But it doesn't have all the node modules as present in my app before packaging. I am forced to manually run npm install inside my packaged folder.
So, the app is not able to perform as expected.
I tried inside package.json
"build": {
"files": [
"/node_modules/**",
"package.json"
]
}
It looks like you are using your package.json wrong way.
Only "dependencies" will be included to the build if you put some package to "devDependencies" it will be excluded from the build.
use no-prune in build using electron packager and place all the modules inside devDependencies and then build the app.
I try to build my electron project to window app by using electron-packager but I get this error.
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?
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
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"
Then run:
npm run electron-package
With slight modification on the answer provided by Michael Denny "electron-package": "ng build --prod && electron-packager . --no-prune --ignore=/node_modules --ignore=/e2e --ignore=/src --overwrite" I'm able to package my electron angular 7 application. Please note, minor modifications might require on these commands, on a case to case to basis. In my case, the following command worked.
"electron-package": "ng build --prod --base-href ./ && electron-packager . --no-prune --ignore=/e2e --ignore=/src --overwrite"
What is the change?
Removed --ignore=/node_modules
Reason: if I add this option while building, Ended up in Module Not Found Error
Added --base-href ./
Reason: Otherwise, Ended up with error Failed to load resource: net::ERR_FILE_NOT_FOUND
With these two modifications, I'm able to package my electron angular 7 application. Size of the package is close to 100MB. I'm looking for a way to reduce this size.
In the directory where your app is, try run this command
electron-packager . --no-prune
More information about this commands can be found in here https://github.com/electron-userland/electron-packager/blob/master/usage.txt
This is related to the issue #821in electron-packager with removing optional platform specific dependencies (possibly only when running packager on Windows).
--no-prune solves the problem during development, but won't work for production.
Reverting to v11.2.0 also solves the issue.
I am trying to package and distribute my app which is written in electron. I noticed that when the binaries build is completed, the local resource/source code are also exposed in the final built folder.
In the resource/app folder, you would have all your source code revealed to anyone who can access.
I am wondering if there's anyway to hide these information, and just deliver the built binary.
I am using Electron 1.2 and electron-packager 7.0.4
Beyond mini-/uglifying your js code (can still be viewed) and creating an .asar package (can be extracted) there is not a whole lot you can do to prevent the visibility of your code.
See also this post on the electron-packager github page:
theres nothing built in to electron to do that, so we don't support
anything like that (since we only support what electron supports). you
would have to implement that in your own module and run it on your
code before using electron-packager -maxogden
If 7 years have passed but are still looking for an answer, they can use #electron/asar. When creating an application with electron packager, it creates a file with an .asar extension that will store your code if you type "--asar" on the terminal screen. For example;
electron-packager . {your exe file name} --overwrite --asar --platform=win32 --arch=x64 --icon={your icon file source} --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="product name"
I am trying to package my electron app . Follwing the instruction Here. I added an object to my package.json like below
"osx-package": "node_modules/electron-packager/cli.js
./build/bin --platform=darwin --arch=x64 --version=0.34.0 --overwrite"
When i run
npm run osx-package
I received the messgage below
Packaging app for platform darwin x64 using electron v0.34.0 Wrote new
app to /...../binary-build-darwin-x64
Below is what i can see from by sublime text.
However, when i visit the folder, i can only see three files . Myapp(i.e execuatble ) , licence file and version file. I unhidden hidden files , still couldnt see my files as expected. However, the files were still shown in the directory in sublime . Clicking my app throws an error saying can't find an electron framework etc. Please what am i misssing ? How do i fix this ?
Did your try running it via the console with npm start?
After packaging the OSX app, the following files should be created:
LICENSE
LICENSES.chromium.html
MYAPP.app
version