electron-userland / electron-wix-msi

:dvd: Create traditional MSI installers for your Electron app
MIT License
318 stars 91 forks source link

Can't set an icon #98

Open layaLils opened 3 years ago

layaLils commented 3 years ago

I am trying to set the path to the icon, like this: const msiCreator = new MSICreator({ . . . , iconPath: 'C:/path/to/electron_app/icon/image.ico', }); But when I execute the ''node build_installer.js'' command to build, I get an error in the console: Unable to extract icon from exe. Please provide an explicit icon via parameter. Error: Cannot find module 'exe-icon-extractor'. I don't know what it is, please, I need help

T-Lacey commented 3 years ago

Hey, I had the same issue! This is what I did to fix it:

const msiCreator = new MSICreator({
    appDirectory: APP_DIR,
    outputDirectory: OUT_DIR,
    description: 'SomeDescriptionHere',
    exe:'SomeNameHere',
    appIconPath: path.resolve(__dirname,'./favicon.ico'),
    name:'SomeNameHere',
    manufacturer:'SomeNameHere',
    version:'0.1.0',
    ui:{
        chooseDirectory: true
    }
})

It is appIconPath: path.resolve(__dirname,'./favicon.ico'), that you need to do. Make sure you change the file name to your icon obviously...

Hope that helps!?

e2eelab commented 4 months ago

appIconPath: ... is changed to icon: ...

hassandaru commented 3 months ago

after creating the file i named it installer.js

how does msi know it should run that of shall i run it using node src/installer.js ??

clear instructions after creating the file are not there.

my structure is:

my-App
    forge.config.js
    package.json
    webpack.main.config.js
    webpack.rules.js
    webpack.renderer.config.js
    out/
    src/
        index.css
        index.html
        main.js
        installer.js

and my package.json has following commands:

{
  "name": "my-app",
  "productName": "my-app",
  "version": "1.0.0",
  "description": "My Electron application description",
  "main": ".webpack/main",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "echo \"No linting configured\""
  },
  "devDependencies": {
    "@electron-forge/cli": "^7.4.0",
    "@electron-forge/maker-deb": "^7.4.0",
    "@electron-forge/maker-rpm": "^7.4.0",
    "@electron-forge/maker-squirrel": "^7.4.0",
    "@electron-forge/maker-wix": "^7.4.0",
    "@electron-forge/maker-zip": "^7.4.0",
    "@electron-forge/plugin-auto-unpack-natives": "^7.4.0",
    "@electron-forge/plugin-fuses": "^7.4.0",
    "@electron-forge/plugin-webpack": "^7.4.0",
    "@electron/fuses": "^1.8.0",
    "@vercel/webpack-asset-relocator-loader": "^1.7.3",
    "css-loader": "^6.11.0",
    "electron": "31.0.1",
    "electron-wix-msi": "^5.1.3",
    "node-loader": "^2.0.0",
    "style-loader": "^3.3.4"
  },
  "keywords": [],
  "author": {
    "name": "Izac mac",
    "email": "hassandaru@gmail.com"
  },
  "license": "MIT",
  "dependencies": {
    "electron-squirrel-startup": "^1.0.1"
  }
}