question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Macro "arch" does not work in artifactName for NSIS

See original GitHub issue
  • Version: 21.2.0

  • Target: Windows (NSIS)

I am using the command electron-builder --ia32 on Windows 10 to create a 32 bit installer for my app. The name of the produced .exe file ends up as Blockbench_3.0.0.exe, where the arch part is stripped from the name.

This is the defined artifactName: "${productName}_${arch}_${version}.${ext}" Here is the relevant build section in my package.json: https://github.com/JannisX11/blockbench/blob/master/package.json#L62-L65

Note that this is an installer specifically for 32-bit Windows. It is not a combined installer. Using a combined installer would double the file size and the download time of the installer.

Related: #3574

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:21 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
zshuaiacommented, Sep 16, 2020

I have the same problem!

${arch} does not take effect in artifactName.

e.g conf: artifactName: "${productName}-${version}-${os}-${arch}.${ext}" output: appname-0.0.1-win.exe

1reaction
mmaiettacommented, Feb 18, 2021

@gknapp it seems they’re all combined. It’s basically assuming that you always want a universal electron installer

I found these differences. Both build a specific arch during the normal build loop. AppxTarget: https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/AppxTarget.ts#L37-L45 MsiTarget: https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/MsiTarget.ts#L43-L51

NsisTarget, on the other hand, queues all architectures and then packages all archs in a single finishBuild task https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts#L64-L66

This is the specific line causing the macro to be ignored: https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts#L130

In order to not break backward compatibility, it seems we’d have to add additional packaging steps for bundling both arch-specific builds and it’s current universal installer. It’s a shame that nsis can’t use Arch.universal flag instead. Any other suggestions?

Btw, if anyone wants to take a stab at this, here is how to set up a local dev env: https://github.com/electron-userland/electron-builder/blob/master/CONTRIBUTING.md#to-setup-a-local-dev-environment

Read more comments on GitHub >

github_iconTop Results From Across the Web

Electron nsis-web, how to change artifacts names
If no arch, macro will be removed from your pattern with leading space, - and _ (so, you don't need to worry and...
Read more >
NSIS
NSIS. The top-level nsis key contains set of options instructing electron-builder on how it should build NSIS target (default target for Windows).
Read more >
What is "artifactName" as used by electron builder?
I believe artifactName is the filename of the installer created. You can define it in the nsis settings section of electron-builder.json: ...
Read more >
Macro vs Function - NSIS Wiki
In NSIS, a Function can only be specified as being for the Installer ... Functions are like macros, except that the code does...
Read more >
electron-builder-squirrel-windows
... arch before testing 'process.arch' on mac silicon (#6381 (828fcd3); nsis: ... artifactName option does not work in build section (6224060), closes #1262 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found