electron / windows-installer

Build Windows Installers for Electron apps
MIT License
1.58k stars 261 forks source link

installer hangs up when building for win32/ia32 from OS X #220

Open 1amGr00t opened 6 years ago

1amGr00t commented 6 years ago

I build my project with electron-forge which uses windows-installer with squirrel target to create an executable installer. But the process hangs up when it comes to electron-windows-installer spawning mono. I build for win32 with 32-bit architecture from my Mac.

Here is the Output from the console:

Making for the following targets:
  electron-forge:hook could not find hook: preMake +1ms
  electron-forge:lifecycle Process Started: Making for target: squirrel - On platform: win32 - For arch: ia32 +3ms
  electron-windows-installer:main Using Mono: 'mono' +0ms
  electron-windows-installer:main Using Wine: 'wine' +0ms
  electron-windows-installer:fs-utils Error: ENOENT: no such file or directory, stat '/Users/.../Projekte/xprintor/out/xprintor-win32-ia32/resources/app.asar' +10ms
  electron-windows-installer:main Created NuSpec file:
  electron-windows-installer:main <?xml version="1.0" encoding="utf-8"?>
  electron-windows-installer:main <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  electron-windows-installer:main   <metadata>
  electron-windows-installer:main     <id>xprintor</id>
  electron-windows-installer:main     <title>xprintor</title>
  electron-windows-installer:main     <version>0.0.1</version>
  electron-windows-installer:main     <authors>author</authors>
  electron-windows-installer:main     <owners>owner</owners>
  electron-windows-installer:main     <iconUrl>https://raw.githubusercontent.com/atom/electron/master/atom/browser/resources/win/atom.ico</iconUrl>
  electron-windows-installer:main     <requireLicenseAcceptance>false</requireLicenseAcceptance>
  electron-windows-installer:main     <description>description</description>
  electron-windows-installer:main     <copyright>copyright</copyright>
  electron-windows-installer:main   </metadata>
  electron-windows-installer:main   <files>
  electron-windows-installer:main     <file src="locales/**" target="lib/net45/locales" />
  electron-windows-installer:main     <file src="resources/**" target="lib/net45/resources" />
  electron-windows-installer:main     <file src="*.bin" target="lib/net45" />
  electron-windows-installer:main     <file src="*.dll" target="lib/net45" />
  electron-windows-installer:main     <file src="*.pak" target="lib/net45" />
  electron-windows-installer:main     <file src="Update.exe" target="lib/net45/squirrel.exe" />
  electron-windows-installer:main     <file src="icudtl.dat" target="lib/net45/icudtl.dat" />
  electron-windows-installer:main     <file src="LICENSE" target="lib/net45/LICENSE" />
  electron-windows-installer:main     <file src="xprintor.exe" target="lib/net45/xprintor.exe" />
  electron-windows-installer:main   </files>
  electron-windows-installer:main </package>
  electron-windows-installer:main  +3ms
  electron-windows-installer:spawn Spawning mono /usr/local/lib/node_modules/electron-forge/node_modules/electron-winstaller/vendor/nuget.exe pack /var/folders/2s/f7qmqftd5k33679ljspvvd4m0000gn/T/si-1171122-17147-169zb4k.alwhg/xprintor.nuspec -BasePath /Users/.../Projekte/xprintor/out/xprintor-win32-ia32 -OutputDirectory /var/folders/2s/f7qmqftd5k33679ljspvvd4m0000gn/T/si-1171122-17147-169zb4k.alwhg -NoDefaultExcludes +21ms

There is nothing special with my electron windows installer config:

  "config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip",
          "dmg"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {
        "dir": "src",
        "ignore": [
          ".gitignore",
          ".idea",
          "tsconfig.json",
          "tslint.json",
          "README.md",
          "dev.env"
        ]
      },
      "electronWinstallerConfig": {
        "name": "<%= productName %>",
        "outputDirectory": "release"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": "com.example.<%= name %>"
      }
    }
  }
jdurand commented 6 years ago

I get something similar except the mono nuget.exe command runs for a while (20-30 minutes) and then outputs:

Attempting to build package from 'MyApp.nuspec'.
Successfully created package '/var/folders/86/vjsqfv1s52d5t7zzx__qvc000000gp/T/si-11805-914-2nz4sa.4hvn/MyApp.0.0.1.nupkg'.
Package does not contain a manifest.

While mono nuget.exe is running, the temp dir contains these 2 files:

-rw-r--r--    1 me staff   1061  5 jan 02:25 MyApp.0.0.1.nupkg
-rw-r--r--    1 me staff   1114  5 jan 02:24 MyApp.nuspec

I did some digging around and found this related post (https://blog.nuget.org/20141023/package-manifests.html) and this nuget issue (https://github.com/NuGet/Home/issues/1290) that could be related. It looks like nuget.exe pack doesn’t require a nuget.manifest.json but the issue discusses nuget excluding the *.nuspec (perhaps making nuget.manifest.json a requirement?)

That kind of sums up my comprehension of the Windows (squirrel, nuget?) build issue. @kevinsawicki Should windows-installer also generate a nuget.manifest.json?


The full console output and accociated log:

DEBUG=electron-windows-installer:* ember electron:make --skip-package --environment=production --platform=win32
Making Electron project.
  electron-windows-installer:main Using Mono: 'mono' +0ms
  electron-windows-installer:main Using Wine: 'wine' +0ms
  electron-windows-installer:spawn Spawning wine /Users/me/Projects/MyApp/node_modules/electron-winstaller/vendor/rcedit.exe /Users/me/Projects/MyApp/electron-out/MyApp-win32-x64/Update.exe --set-icon assets/icons/myapp.ico +14ms
  electron-windows-installer:fs-utils Error: ENOENT: no such file or directory, stat '/Users/me/Projects/MyApp/electron-out/MyApp-win32-x64/resources/app.asar'
  electron-windows-installer:fs-utils
  electron-windows-installer:fs-utils  +7s
  electron-windows-installer:main Created NuSpec file:
  electron-windows-installer:main <?xml version="1.0" encoding="utf-8"?>
  electron-windows-installer:main <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  electron-windows-installer:main   <metadata>
  electron-windows-installer:main     <id>MyApp</id>
  electron-windows-installer:main     <title>MyApp</title>
  electron-windows-installer:main     <version>0.0.1</version>
  electron-windows-installer:main     <authors>MyApp inc.</authors>
  electron-windows-installer:main     <owners>MyApp inc.</owners>
  electron-windows-installer:main     <iconUrl>https://raw.githubusercontent.com/atom/electron/master/atom/browser/resources/win/atom.ico</iconUrl>
  electron-windows-installer:main     <requireLicenseAcceptance>false</requireLicenseAcceptance>
  electron-windows-installer:main     <description>Some description</description>
  electron-windows-installer:main     <copyright>Copyright © 2018 MyApp inc.</copyright>
  electron-windows-installer:main   </metadata>
  electron-windows-installer:main   <files>
  electron-windows-installer:main     <file src="locales/**" target="lib/net45/locales" />
  electron-windows-installer:main     <file src="resources/**" target="lib/net45/resources" />
  electron-windows-installer:main     <file src="*.bin" target="lib/net45" />
  electron-windows-installer:main     <file src="*.dll" target="lib/net45" />
  electron-windows-installer:main     <file src="*.pak" target="lib/net45" />
  electron-windows-installer:main     <file src="Update.exe" target="lib/net45/squirrel.exe" />
  electron-windows-installer:main     <file src="icudtl.dat" target="lib/net45/icudtl.dat" />
  electron-windows-installer:main     <file src="LICENSE" target="lib/net45/LICENSE" />
  electron-windows-installer:main     <file src="MyApp.exe" target="lib/net45/MyApp.exe" />
  electron-windows-installer:main   </files>
  electron-windows-installer:main </package>
  electron-windows-installer:main  +3ms
  electron-windows-installer:spawn Spawning mono /Users/me/Projects/MyApp/node_modules/electron-winstaller/vendor/nuget.exe pack /var/folders/86/vjsqfv1s52d5t7zzx__qvc000000gp/T/si-11805-914-2nz4sa.4hvn/MyApp.nuspec -BasePath /Users/me/Projects/MyApp/electron-out/MyApp-win32-x64 -OutputDirectory /var/folders/86/vjsqfv1s52d5t7zzx__qvc000000gp/T/si-11805-914-2nz4sa.4hvn -NoDefaultExcludes +3ms
An error occured while making for target: squirrel

Stack Trace and Error Report: /var/folders/86/vjsqfv1s52d5t7zzx__qvc000000gp/T/error.dump.12ce492c4547d087c10635662cd42a99.log

error.dump.12ce492c4547d087c10635662cd42a99.log :

=================================================================================

ENV Summary:

  TIME: Fri Jan 05 2018 14:48:21 GMT-0500 (EST)
  TITLE: ember
  ARGV:
  - /usr/local/Cellar/node@8/8.9.3_1/bin/node
  - /usr/local/bin/ember
  - electron:make
  - --skip-package
  - --environment=production
  - --platform=win32
  EXEC_PATH: /usr/local/Cellar/node@8/8.9.3_1/bin/node
  TMPDIR: /var/folders/86/vjsqfv1s52d5t7zzx__qvc000000gp/T
  SHELL: /usr/local/bin/zsh
  PATH:
  - /Users/me/.rvm/gems/ruby-2.4.2/bin
  - /Users/me/.rvm/gems/ruby-2.4.2@global/bin
  - /Users/me/.rvm/rubies/ruby-2.4.2/bin
  - /Users/me/.rvm/bin
  - /Users/me/google-cloud-sdk/bin
  - /usr/local/bin
  - /usr/bin
  - /bin
  - /usr/sbin
  - /sbin
  - /opt/X11/bin
  - /usr/local/sbin
  - /Users/me/.bin
  - /Users/me/Library/Haskell/bin
  - /Users/me/work/go/bin
  - /Users/me/.composer/vendor/bin
  - /Applications/Postgres.app/Contents/Versions/9.4/bin
  PLATFORM: darwin x64
  FREEMEM: 1430798336
  TOTALMEM: 17179869184
  UPTIME: 175299
  LOADAVG: 2.9072265625,2.94287109375,2.83251953125
  CPUS:
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.10.1-DEV
  - cldr: 32.0.1
  - http_parser: 2.7.0
  - icu: 60.2
  - modules: 57
  - nghttp2: 1.25.0
  - node: 8.9.3
  - openssl: 1.0.2n
  - tz: 2017c
  - unicode: 10.0
  - uv: 1.15.0
  - v8: 6.1.534.48
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: [undefined]
  - codeFrame: [undefined]
  - errorMessage: An error occured while making for target: squirrel
  - errorType: [undefined]
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
  - message: An error occured while making for target: squirrel
  - name: [undefined]
  - nodeAnnotation: [undefined]
  - nodeName: [undefined]
  - originalErrorMessage: [undefined]
  - stack: Failed with exit code: 1
Output:
Attempting to build package from 'MyApp.nuspec'.
Successfully created package '/var/folders/86/vjsqfv1s52d5t7zzx__qvc000000gp/T/si-11805-914-2nz4sa.4hvn/MyApp.0.0.1.nupkg'.
Package does not contain a manifest.

Error: Failed with exit code: 1
Output:
Attempting to build package from 'MyApp.nuspec'.
Successfully created package '/var/folders/86/vjsqfv1s52d5t7zzx__qvc000000gp/T/si-11805-914-2nz4sa.4hvn/MyApp.0.0.1.nupkg'.
Package does not contain a manifest.

  at ChildProcess.proc.on.code (/Users/me/Projects/MyApp/node_modules/electron-winstaller/lib/spawn-promise.js:62:16)
  at emitTwo (events.js:126:13)
  at ChildProcess.emit (events.js:214:7)
  at maybeClose (internal/child_process.js:925:16)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

=================================================================================
jdurand commented 6 years ago

More on this; when I run this command in isolation with -Verbosity detailed from a directory containing the .nupkg & .nuspec files:

mono /Users/me/MyApp/node_modules/electron-winstaller/vendor/nuget.exe pack MyApp.nuspec -BasePath /Users/me/MyApp/electron-out/MyApp-win32-x64 -OutputDirectory ./ -NoDefaultExcludes -NoPackageAnalysis -Verbosity detailed
Attempting to build package from 'MyApp.nuspec'.

I get this output:

System.InvalidOperationException: Package does not contain a manifest.
  at NuGet.OptimizedZipPackage.EnsureManifest () [0x00035] in <3c93a88a29d041668b07b864a37db626>:0
  at NuGet.OptimizedZipPackage..ctor (System.String fullPackagePath) [0x0007c] in <3c93a88a29d041668b07b864a37db626>:0
  at NuGet.Commands.PackCommand.PrintVerbose (System.String outputPath) [0x0000b] in <3c93a88a29d041668b07b864a37db626>:0
  at NuGet.Commands.PackCommand.BuildPackage (NuGet.PackageBuilder builder, System.String outputPath) [0x000ae] in <3c93a88a29d041668b07b864a37db626>:0
  at NuGet.Commands.PackCommand.BuildFromNuspec (System.String path) [0x0005c] in <3c93a88a29d041668b07b864a37db626>:0
  at NuGet.Commands.PackCommand.BuildPackage (System.String path) [0x00018] in <3c93a88a29d041668b07b864a37db626>:0
  at NuGet.Commands.PackCommand.ExecuteCommand () [0x000b6] in <3c93a88a29d041668b07b864a37db626>:0
  at NuGet.Commands.Command.Execute () [0x000d3] in <3c93a88a29d041668b07b864a37db626>:0
  at NuGet.Program.Main (System.String[] args) [0x001a9] in <3c93a88a29d041668b07b864a37db626>:0
1amGr00t commented 6 years ago

It seems that the exe file will be generated if I wait long enough, it takes more than 30 minutes. Thats too long. So are there any solutions for this issue here?

georgemcg commented 6 years ago

For me, if I add the flag: "asar": true to electronPackagerConfig (if you're using forge, don't know otherwise) then it finishes in a couple of minutes, down from an hour.

This old issue helped: https://github.com/electron/windows-installer/issues/55

1amGr00t commented 6 years ago

Yeah that's not very comfortable as it takes too long...

jdurand commented 6 years ago

I can't pin point exactly what fixed it for me, but I had identified corber (or one of it's dependencies) as the cause of the *.nuspec package not compiling and had to script something that removed corber prior to making the win32 package.

Now, setting these fixed everything for me :

"electronPackagerConfig": {
  "packageManager": "yarn",
  "asar": true,
}

The win32 make succeeds without removing corber and completes within a minute!

frederikbosch commented 6 years ago

I also had the same problem, and also got it fixed with "asar":true

benjtinsley commented 6 years ago

I also had the same issues and found the solution by setting "asar" to true in the electronPackagerConfig - but does anyone know why this fixes it? I am happy that it does, I am just not sure why it fixes.

jdurand commented 6 years ago

It’s reasonable to think that using asar fixes some issues with path names that could be too long for the Windows/Mono/Wine build step... I’m just speculating here. References: