Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsis - portable & installer #1340

Closed
kossolax opened this issue Mar 7, 2017 · 12 comments · May be fixed by qcif/data-curator#563
Closed

nsis - portable & installer #1340

kossolax opened this issue Mar 7, 2017 · 12 comments · May be fixed by qcif/data-curator#563

Comments

@kossolax
Copy link
Contributor

kossolax commented Mar 7, 2017

  • Version: 14.5.3
  • Target: win64 - nsis/portable

When you are building both portable and installer, building fails. I'm using electron-builder@14.5.3

Exception: The process cannot access the file because it is being used by another process.
package.json:

    "win": {
      "target": ["nsis", "portable"],
    },
    "nsis": {
      "unicode": false,
      "artifactName": "${productName}Installer.${version}.${ext}",
    }

I suppose both output have the same artifactName and the same temporary file name (.nsis.7z), Can we also have a new file macro depending on installer-portable version we are building?
${productName}${buildTarget}.${version}.${ext}

Thanks

@develar
Copy link
Member

develar commented Mar 7, 2017

Specify custom artifactName in the portable.

"portable": {
      "unicode": false,
      "artifactName": "${productName}Installer.${version}.${ext}",
    }

But.... damn. You cannot due to config verification :(

@hovancik
Copy link

hovancik commented Mar 7, 2017

same here:

    "electron": "^1.6.1",
    "electron-builder": "^15.1.1",
"win": {
      "target": [
        "nsis",
        "portable",
        "7z",
        "zip"
      ]
    }

@develar
Copy link
Member

develar commented Mar 13, 2017

#1340 (comment) working again in the 15.3.0+

@kossolax
Copy link
Contributor Author

I think you fixed the artifact name, but I still can't build.

Here is package.json:

    "win": {
      "target": ["nsis", "portable"]
    },
    "nsis": {
      "unicode": false,
      "artifactName": "${productName}Installer.${version}.${ext}"
    },
    "portable": {
      "unicode": false,
      "artifactName": "${productName}Portable.${version}.${ext}"
    }

and error output:

build -w --x64 --publish never

Packaging for win32 x64 using electron 1.4.15 to dist\win-unpacked
Building NSIS installer
Building NSIS installer
Packaging NSIS installer for arch x64
Packaging NSIS installer for arch x64
Error: C:[...]\node_modules\7zip-bin-win\x64\7za.exe exited with code 2
Output:
[...]
Error:
cannot open file
C:[...]\dist\designer-0.5.1-x64.nsis.7z
The file exists.

So both portable and nsis run in parallel, both trying to create temporary file, at the same time xxx-yyy-x64.nsis.7z.

Thanks for your care

@kossolax
Copy link
Contributor Author

I forgot to mention that's I've tested using electron-builder 15.4.1 version.

@develar develar reopened this Mar 13, 2017
@develar
Copy link
Member

develar commented Mar 13, 2017

@kossolax Fixed in 15.4.2. Test added.

@kossolax
Copy link
Contributor Author

I've updated to 15.4.2, but building still fail. I suppose your previous patch fix when you don't set a artifactName at all. Sorry to insist, but it's look like we don't understand each others.

If I build only a portable version it works. If I build only a nsis installer version it works. If I build both at the same time by setting "target": ["nsis", "portable"]" it still doesn't work.

The process cannot access the file because it is being used by another process.

I'm pretty sure it's because both process run in parallel, and both trying to build the archive with the same temporary name "designer-0.5.1-x64.nsis.7z". Please note the "temporary name" is not the same as the final artifact name. "DesignerInstaller.0.5.1.exe"

I hope this clarify issue.

@develar develar reopened this Mar 13, 2017
@develar develar added bug and removed question labels Mar 13, 2017
@kossolax
Copy link
Contributor Author

kossolax commented Mar 29, 2017

Hello,

You could change this line into something like...

const archiveFile = path.join(this.outDir, ${packager.appInfo.name}-${packager.appInfo.version}-${this.isPortable ? "portable" : "setup"}-${packager.appInfo.version}-${packager.appInfo.version}-${Arch[arch]}.nsis.${format})

So both will create differents temp ".nsis.7z" file. Sadly, this throw another error while converting the .nsis.7z file into a .exe files. The target .exe file is only 150 Ko, and .nsis.7z disapeard.

electron-builder@16.5.1

Error: C:[...]\nsis\nsis-3.0.1.10\Bin\makensis.exe exited with code 1
[...]
Command line defined: "APP_64=C:[...]\Designer\dist\designer-portable-0.7.0-x64.nsis.7z"
Command line defined: "APP_64_NAME=designer-portable-0.7.0-x64.nsis.7z"
[...]
Output: "C:[...]\Designer\dist\DesignerPortable.0.7.0.exe"

Error output:
Can't open output file
Error - aborting creation process

@develar develar closed this as completed in 918a317 Apr 8, 2017
@kossolax
Copy link
Contributor Author

Hello again,

Thanks for your update.

When I'm building, I've only one artifact build, but the error is gone. Here is my package.json
It's look like both portable & nsis are building into same artifactName.

    "win": {
      "target": ["nsis", "portable"],
      "icon": "resources/images/logo.ico"
    },
    "nsis": {
      "artifactName": "${productName}Installer.${version}.${ext}",
      "installerIcon": "resources/images/logo.ico",
      "installerHeaderIcon": "resources/images/logo.ico"
    },
    "portable": {
      "artifactName": "${productName}Portable.${version}.${ext}"
    }

I was watching file creation process:

  • building 7z file
  • creating portable.exe 0Ko
  • building portable.exe 150 Ko
  • merging 7z into portable.exe 30Mo
  • creating portable.exe 0Ko
  • building portable.exe 150 Ko
  • merging 7z into portable.exe 30Mo

You can notice the output file at line 238 and 274 from log. err.txt

@kossolax
Copy link
Contributor Author

Hello,

I've just tested with the 17.0.2 version, same issue. @hovancik have you got the same issue ?

@develar develar reopened this Apr 18, 2017
@Sazpaimon
Copy link

For the record, I also have the same behavior. I have to build nsis and portable separately in order to have both.

@kossolax
Copy link
Contributor Author

Hello again,
The issue is still present on lastest release, but the issue is only present when you specify a custom artifact name.

Otherwise the compilation produce correctly the 2 outputs.

https://github.com/electron-userland/electron-builder/blob/master/packages/electron-builder/src/targets/nsis.ts#L132

But it doesn't with that's kind of config:

    "nsis": {
      "artifactName": "${productName}Installer.${version}.${ext}",
      "installerIcon": "resources/images/logo.ico",
      "installerHeaderIcon": "resources/images/logo.ico",
    },
    "portable": {
      "artifactName": "${productName}Portable.${version}.${ext}"
    }

I hope this help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants