Reputation: 21
So, I have this in my package.json:
{
"name" : "webgl-demo",
"version" : "1.1.0",
"main" : "main.js",
"scripts" : {
"build": "electron-packager . webgl --platform=win32 --arch=x64 --version=0.33.3 --overwrite"
}
}
From command-line I build the executable using this:
npm run build
I used the electron-sample-apps\webgl project as a guinea pig. I got a webgl.exe in a electron-sample-apps\webgl\webgl-win32-x64 folder. But when I run it, I get a pop-up saying that "A javascript error occurred in the main process". A little further down in the pop-up text it says: "SyntaxError: Unexpected token {". I have no clue what that is trying to tell me? Has anyone ever gotten this to work?
By the way I am using npm version 2.15.8, electron version 4.4.3 and running on a Windows 10 machine.
This is cool, not only does it not work, when I run the executable it creates not one, but two electron.exe processes, and they don't go away after the error pop-up is dealt with. So, I have to pop open taskmgr.exe and kill the electron.exe processes before I can try to build again.
Has anyone ever made a custom .exe successfully for Windows with this stuff?
Upvotes: 2
Views: 1271
Reputation: 55
I have used electron-packager to build win32-x64 exe app. After the build was created, I copied the folder to another Windows 10 machine to see if it has any dependencies (Needed).
To my surprise (and glory), it worked just perfect. Everything that's needed to run the app (All dependencies) are included in the built itself.
You can further use inno setup to create a setup.exe file (Packaging)
Upvotes: 2
Reputation: 2203
I recommend you to build your packages with the API of electron-packager
, it's more easier than command line.
Here is my script, you can run it with node file-name.js
'use strict';
var packager = require('electron-packager');
var options = {
'arch': 'ia32',
'platform': 'win32',
'dir': './',
'app-copyright': 'Paulo Galdo',
'app-version': '2.1.6',
'asar': true,
'icon': './app.ico',
'name': 'TierraDesktop',
'out': './releases',
'overwrite': true,
'prune': true,
'version': '1.3.4',
'version-string': {
'CompanyName': 'Paulo Galdo',
'FileDescription': 'Tierra de colores', /*This is what display windows on task manager, shortcut and process*/
'OriginalFilename': 'TierraDesktop',
'ProductName': 'Tierra de colores',
'InternalName': 'TierraDesktop'
}
};
packager(options, function done_callback(err, appPaths) {
console.log("Error: ", err);
console.log("appPaths: ", appPaths);
});
Check here what options have the electron-packager API
link
Upvotes: 1