Reputation: 161
I'm trying to automate the build of an electron app using Jenkins. Before I did it using electron-packager directly on a windows PC (because the app is intended to be used in windows) but now that I want to use a Linux environment for the build process (ex. Ubuntu) I get the following error :
15:55:32 Packaging app for platform win32 ia32 using electron v1.8.7
15:55:36 WARNING: Found 'electron' but not as a devDependency, pruning anyway
15:56:21 Could not find "wine" on your system.
15:56:21
15:56:21 Wine is required to use the appCopyright, appVersion, buildVersion, icon, and
15:56:21 win32metadata parameters for Windows targets.
15:56:21
15:56:21 Make sure that the "wine" executable is in your PATH.
15:56:21
15:56:21 See https://github.com/electron-userland/electron-packager#building-windows-apps-from-non-windows-platforms for details.
Old Packaging script (defined in package.json)
electron-packager . test-app --overwrite --asar --platform=win32 --arch=ia32 --prune=true --out=release-builds
As suggested I created a gulp script for the packaging:
var opts = {
name: pkg.name,
platform: 'win32',
arch: 'ia32', // ia32, x64 or all
dir: './', // source location of app
out: './edist/', // destination location for app os/native binaries
asar: true, // compress project/modules into an asar blob but don't use asar to pack the native compiled modules
overwrite: true,
prune: true,
electronVersion: electronVersion , // Tell the packager what version of electron to build with
appCopyright: pkg.copyright, // copyright info
appVersion: pkg.version, // The version of the application we are building
win32metadata: { // Windows Only config data
CompanyName: pkg.authors,
ProductName: pkg.name,
FileDescription: pkg.description,
OriginalFilename: pkg.name + '.exe'
}
};
gulp.task('build:electron', done => {
console.log('Launching task to package binaries for ' + opts.name + ' v' + opts['appVersion']);
packager(opts).then(appPaths => {
console.log(' PackagerDone(). appPaths : ', appPaths);
var zippedPromises = appPaths.map(function (appPath) {
console.log('Preparing pipe for zip ', appPath + ".zip");
return zipFolder(appPath, appPath + ".zip");
});
Promise.all(zippedPromises).then(function () {
console.log(' Zip file created.');
}).catch(function (error) {
console.error(error, error.stack);
});
done();
});
});
which again, works in Windows, but returns the same Error on Ubuntu. (zipFolder converts the release folder in a zip file, it is just an extra function I wrote)
My question is, is it possible to just not install wine at all and make it work ?
Upvotes: 1
Views: 3426
Reputation: 161
At the end, the solutions could be, either run the build script directly in a Windows environment, or install Wine under Linux (where Jenkins was 'living'). The idea from @Kim Gentes helped me thought, specially to organized the build script in a better and more readable way.
Upvotes: 0
Reputation: 1628
The short answer is that you can use the electron-packager
API more effectively when trying to run in a build script/Jenkins environment. At least, that is what I found. This allows you to configure and parameterize your building much more succinctly.
In our case, we wrapped the electron-packager
in a nice gulp
script to make it build nicely and to be nicely callable from Jenkins.
This link might give you a sense of how to go about it and the standard components that would be good to use:
Example of Building an Electron app with electron-packager
Upvotes: 1