2

I want to make a Windows installer with electron.js, I referred to nsis config

I have set "oneClick": false

However, whenever I build the app with: npm run build

The option always shows as oneClick=true on build.

Have also tried npm run build-installer, to no avail. Same one click output :-(

I dont understand why is wouldnt accept the oneClick option, it had worked before, now I cant figure out why it just stopped working.

enter image description here

Here is an excerpt from package.json

"scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "echo \"No linting configured\"",
    "build-installer": "electron-builder",
    "build": "electron-builder"
  },
  
  "build": {
    "appId": "apppppppp",
    "win": {
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64"
          ]
        }
      ],
      "icon": "/src/images/icons/manifest-icon-512.maskable.png"
    }
  },
  "nsis": {
    "oneClick": false,
    "perMachine": false,
    "allowElevation": true,
    "allowToChangeInstallationDirectory": true
  },
  "dependencies": {},
  "devDependencies": {
    "@electron-forge/cli": "^6.0.0-beta.63",
    "@electron-forge/maker-deb": "^6.0.0-beta.63",
    "@electron-forge/maker-rpm": "^6.0.0-beta.63",
    "@electron-forge/maker-squirrel": "^6.0.0-beta.63",
    "@electron-forge/maker-zip": "^6.0.0-beta.63",
    "electron": "16.0.7",
    "build-installer": "electron-builder",
    "build": "electron-builder"
  }
}
5
  • Is the NSIS tag really relevant here?
    – Anders
    Commented Jan 24, 2022 at 12:16
  • @Anders, Custom NSIS scripts may be required so thats why NSIS also added in the tag Commented Jan 24, 2022 at 19:11
  • This question is about electron builder. NSIS does not use JSON anywhere.
    – Anders
    Commented Jan 25, 2022 at 2:46
  • link custom .nsh scripts Commented Jan 25, 2022 at 20:24
  • You question is about oneclick, not custom scripts
    – Anders
    Commented Jan 25, 2022 at 22:26

2 Answers 2

4

I put the "nsis" options inside the "build" options and it worked.

1

I'm a bit late, but this might help with your problem if you ever see this.

"build": {
    "nsis": {
      "oneClick": false,
      "perMachine": false,
      "allowElevation": true,
      "allowToChangeInstallationDirectory": true,
      "deleteAppDataOnUninstall": false,
      "displayLanguageSelector": false,
      "unicode": true,
      "shortcutName": "something",
      "warningsAsErrors": true,
      "runAfterFinish": true,
      "createDesktopShortcut": "always",
      "createStartMenuShortcut": true,
      "menuCategory": false
    },
    "win": {
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64",
            "ia32"
          ]
        }
      ],
      "icon": "something.png"
    }
  }
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Sep 15, 2023 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.