I have created Desktop app into linux app with supporting files,now i wanted to make into single file (executable),so that it can be share to anyone. Is there way to make it into executable file
Packaging any app on any platform needs some libraries, wether static or dynamically linked. Packaging into one single executable file will never work, at least with Electron.
Packaging your Node.js Electron source files into an executable (also known as compiling) is easy - if you use electron-packager
. That's a Node.js "plugin" you can install (and save as dev-dependency) via NPM with the following command:
npm install --save-dev electron-packager
Next, you can create a "build" script inside your package.json
like that:
"scripts": {
"build-linux64": "electron-packager . ProjectName --platform=linux --arch=x64"
}
This script will compile your project for a 64-bit Linux system. For other switches, please refer to the electron-packager documentation, as available here.
After that, there should be a folder called ProjectName-platform-arch
in your project's main directory, which you can zip up and distribute. This executable (ProjectName
in the output folder) will then be executable on any 64-bit Linux OS without Node.js installed.
But, to mention it at least, this is not an installer. For Linux you can build a "package", like *.deb
for Debian/Ubuntu and derivates, *.rpm
for RedHat, OpenSuSE, SLES, SLED, Fedora and derivates or *.tar.gz
for plain source code packages (like apt
uses). This can't be achieved with electron-packager
but with the on-board tools of your Linux OS. There are some great tutorials on how to build Linux packages in the net out there, but this certainly goes far out of the boundaries of this answer.