electron-userland/electron-installer-debian

Error generating DEB with version 1.1.0

jeanlucburot opened this issue ยท 17 comments

What version of electron-installer-debian are you using?
1.1.0

What version of node and npm are you using?
node -v v11.6.0
npm -v 6.5.0

What operating system are you using?
Linux Mint 19.1 Tessa, having Ubuntu 18.04 as base.

Can you compile the example app successfully?

If not, paste here the output of the following commands:

$ git clone https://github.com/electron-userland/electron-installer-debian.git
$ cd electron-installer-debian/example
$ DEBUG='electron-installer-debian' npm run build

What did you do? Please include the configuration you are using for electron-installer-debian.
In order to create a *.deb from my electron project, I executed the npm script calls, first yarn build then yarn deb64. My script setting is:

  "scripts": {
    "start": "electron .",
    "build": "electron-packager . app --platform linux --arch x64 --out dist/",
    "deb64": "electron-installer-debian --src dist/app-linux-x64/ --dest dist/installers/ --arch amd64"
  },

What did you expect to happen?
I expected to get a *.deb file in dist/installers.

What actually happened?
I got an error:

$ electron-installer-debian --src dist/app-linux-x64/ --dest dist/installers/ --arch amd64
Creating package (this may take a while)
Error: Error creating contents of package: Error creating binary symlink: could not find the Electron app binary at "dist/app-linux-x64/administration". You may need to re-bundle the app using Electron Packager's "executableName" option.
at err (/home/jean/Documents/NewProject/administration/node_modules/electron-installer-common/src/error.js:12:13) Error: Error creating contents of package: Error creating binary symlink: could not find the Electron app binary at "dist/app-linux-x64/administration". You may need to re-bundle the app using Electron Packager's "executableName" option.\n at err (/home/jean/Documents/NewProject/administration/node_modules/electron-installer-common/src/error.js:12:13)
error Command failed with exit code 1.

So, the path dist/app-linux-x64/administration obviously does not exist. It should be asking for dist/app-linux-x64 instead. The project's name is called "name": "administration",, so there might be a mix up in electron-installer-debian version 1.1.0.

I solved this matter by moving one version down to electron-installer-debian version 1.0.1. Now everything works perfectly. I get the *.deb file as expected.

In order to debug your problem further, we need a minimal testcase to reproduce your problem. Using the electron-quick-start repository as a base, could you please create a minimal Electron app that illustrates the issue you described, and post a link to it here?

@jeanlucburot what command did you use to run electron-packager? Do you have a productName field in your package.json, what is it?
You probably don't see an error on v1.0.1 but if you install the deb created with that version, your app probably won't launch at all. Can you test that?
We introduce this error message to avoid people packaging their apps and then not working at all.

@malept I will create a minimal test case and come back here.

@fcastilloec I launched it using yarn 1.12.3 and you're right. After having a test installation of the resulting DEB file on a newly installed system I cannot find the application. It's as if I didn't install it at all.

My package.json:

{
  "name": "administration",
  "version": "1.0.0",
  "description": "Administration application.",
  "main": "index.js",
  "scripts": {
    "start": "electron .",
    "build": "electron-packager . app --platform linux --arch x64 --out dist/",
    "deb64": "electron-installer-debian --src dist/app-linux-x64/ --dest dist/installers/ --arch amd64",
    "compile": "yarn build && yarn deb64"
  },
  "author": "My Author",
  "license": "ISC",
  "devDependencies": {
    "electron": "^4.0.1",
    "electron-installer-debian": "1.0.1",
    "electron-installer-zip": "^0.1.2",
    "electron-packager": "^13.0.1"
  }
}

@malept So, I cloned https://github.com/electron/electron-quick-start.git and modified the package.json like this:

{
  "name": "electron-quick-start",
  "version": "1.0.0",
  "description": "A minimal Electron application",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "build": "electron-packager . app --platform linux --arch x64 --out dist/",
    "deb64": "electron-installer-debian --src dist/app-linux-x64/ --dest dist/installers/ --arch amd64"
  },
  "repository": "https://github.com/electron/electron-quick-start",
  "keywords": [
    "Electron",
    "quick",
    "start",
    "tutorial",
    "demo"
  ],
  "author": "GitHub",
  "license": "CC0-1.0",
  "devDependencies": {
    "electron": "^4.0.1",
    "electron-installer-debian": "^1.1.0",
    "electron-packager": "13.0.1"
  }
}

I then ran yarn && yarn build without errors. But when running yarn deb64 I get the following error:

jean@wrk-jean:~/Desktop/test_case/electron-quick-start$ yarn deb64
yarn run v1.12.3
$ electron-installer-debian --src dist/app-linux-x64/ --dest dist/installers/ --arch amd64
Creating package (this may take a while)
Error: Error creating contents of package: Error creating binary symlink: could not find the Electron app binary at "dist/app-linux-x64/electron-quick-start". You may need to re-bundle the app using Electron Packager's "executableName" option.
    at err (/home/jean/Desktop/test_case/electron-quick-start/node_modules/electron-installer-common/src/error.js:12:13) `Error: Error creating contents of package: Error creating binary symlink: could not find the Electron app binary at "dist/app-linux-x64/electron-quick-start". You may need to re-bundle the app using Electron Packager's "executableName" option.\n    at err (/home/jean/Desktop/test_case/electron-quick-start/node_modules/electron-installer-common/src/error.js:12:13)`
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

So what exactly is the Electron Packager's executableName option?

After having a test installation of the resulting DEB file on a newly installed system I cannot find the application. It's as if I didn't install it at all.

Yes, I see why:

"build": "electron-packager . app --platform linux --arch x64 --out dist/",

You're specifying the Electron application name in the command line parameters (app) instead of letting Electron Packager infer it from the name field in package.json. electron-installer-debian infers the name in the same way.

So what exactly is the Electron Packager's executableName option?

See the Electron Packager API docs. (A brief description is also available if you run $(npm bin)/electron-packager --help.)

I'm commenting here rather than opening a new issue, though I'm pretty sure that this is an issue that is yet to be solved.

so my error is Error creating contents of package: Error creating binary symlink: could not find the Electron app binary at "dist/app/Foo Bar-linux-x64/foo-bar" while I actually have an executable dist/app/Foo Bar-linux-x64/Foo Bar (notice the expected kebab case, presumably coming from name in package.json instead of productName)

and my package.json says

{
  "name": "foo-bar",
  "productName: "Foo Bar",
  ...
}

and the same result is with and without second positional argument (the app name) given to the electron-packager command.

Maybe I should also mention that I'm running the electron-installer-dmg and electron-installer-zip and those run just fine.

Yes, I see why:

"build": "electron-packager . app --platform linux --arch x64 --out dist/",

You're specifying the Electron application name in the command line parameters (app) instead of letting Electron Packager infer it from the name field in package.json. electron-installer-debian infers the name in the same way.

So what exactly is the Electron Packager's executableName option?

See the Electron Packager API docs. (A brief description is also available if you run $(npm bin)/electron-packager --help.)

After reading docs and on multiple failure, successfully builded by Keeping name in packaje.json and electron-packager . app <-- this app (electron app name ) and package.json name should be same case sensitive

Happy Coding!

mran3 commented
{
  "name": "forged-text",
...
  "config": {
    "forge": {
      "packagerConfig": {
        "name": "forged-text"
      }
....

Both names in packager config and main package info should be the same on your package.json if you are using electron-forge on debian.

Per the error message, you should be using the executableName in packagerConfig, not name.

mran3 commented

Don't know if executableName can also solve it, I had this problem and putting both names the same solved it for me.

It would help if you could provide a minimal repository demonstrating the bug.

mran3 commented

I am not reporting a bug, I am providing a possible solution for others having this problem.

If you need to specify both the name in package.json and in the packager config in Forge, that sounds like either a bug or a problem with documentation, which should be fixed.

Both names in packager config and main package info should be the same on your package.json if you are using electron-forge on debian.

I had the same problem, and it was fixed using this.

I also experienced this error. I posted how to fix the error after a lot of trial and error.

https://it-jm.tistory.com/187

Just a small note that might be of assistance to someone:

When using electron-forge, and in the case when name and productName have different values, electron-installer-debian will try to copy bin from the wrong place (due to defaults that uses package.name), so you need to specify bin property in your maker options like this:

{
    name: '@electron-forge/maker-deb',
    config: {
        options: {
            bin: appName, // same as productName