2
votes

I have create a python3 app using the Electron environment (itself based on Node.js).
For this app, the dependencies have been installed using npm and my app launches using the npm start command.

Following the documentation of Electron, it seems that Electron-builder is the best option for distributing my app for all platforms. Unfortunately, the installation guide recommends using yarn, not npm as npm might not be working properly : see related ticket

Now my question is: As the ticket is rather old (2017), is it now possible to make it work with npm ? So yes how ?

If it is not possible to make it work with npm, how do I transition my code to yarn ?

For info:
The reason I ask is because I get a BIIIIIG error message when I run the command npm run dist. If needed I can edit the post to include it (alongside my package.json file)

Thanks in advance.

EDIT: adding error and package.json

{
  "name": "APP_NAME",
  "version": "1.0.0",
  "description": "The first version of APP_NAME's GUI.",
  "main": "index.js",
  "homepage": "https://docenhance.com",
  "author": "DocEnhance <[email protected]>",
  "license": "MIT",
  "scripts": {
    "postinstall": "electron-builder install-app-deps",
    "start": "npm install && electron .",
    "pack": "electron-builder --dir",
    "dist": "electron-builder"
  },
  "build": {
    "appId": "com.docenhance.APP_NAME",
    "productName": "APP_NAME - PROJECT_NAME",
    "linux": {
      "target": "deb",
      "icon": "build/icon.icns",
      "category": "Office"
    }
  },

  "devDependencies": {
    "bootstrap": "^4.1.2",
    "electron": "^4.0.7",
    "electron-builder": "^20.39.0",
    "jquery": "^3.3.1"
  },
  "dependencies": {
    "bootstrap": "^4.3.1",
    "jquery": "^3.3.1",
    "popper.js": "^1.14.7",
    "python-shell": "^1.0.7"
  }
}

The error file can be found HERE.

1
I sure think the error message would be helpful :D While your at it, also post your package.json - Elias

1 Answers

2
votes

Yes, you can use npm. The yargs issue is explained here.

Your error messages tell you . . . what the errors are.

error output:[ERROR] Unknown input file format: /home/MYUSERNAME/Documents/APP_DIRECTORY/dist/.icon-set/icon_ICN#.jp2 Known file formats are *.j2k, *.jp2, *.jpc or *.jpt

I don't use or work on Linux so I don't know for sure if this is the case, but you are specifying a .icns file format for your icon. That is an OSX icon file format. Your error message says that Electron Builder doesn't know what to do with that (on Linux).

"linux": {
      "target": "deb",
      "icon": "build/icon.icns",
      "category": "Office"
    }

The rest of the scary error text likely just cascades from that.