electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.39k stars 500 forks source link

make window installer on mac failed & 'all' is an invalid platform #2925

Closed chudongvip closed 2 years ago

chudongvip commented 2 years ago

Pre-flight checklist

Electron Forge version

6.0.0-beta.65

Electron version

v20.0.2

Operating system

macOS 10.15.7

Last known working Electron Forge version

No response

Expected behavior

I wanna make windows and mac installer via @electron-forge/maker-dmg and @electron-forge/maker-squirrel.

Actual behavior

PS: I have install Mono(v6.12.0.182) and wine-stable(v7.0) on my MBP.

Steps to reproduce

1. Set the make platform option to all

2. exec npm run make

I hope make the window and mac installer when I exec npm run make

There will be throw this errors:

> electron-forge make --platform=all

✔ Checking your system
✔ Resolving Forge Config

An unhandled rejection has occurred inside Forge:
Error: 'all' is an invalid platform. Choices are 'darwin', 'mas', 'win32' or 'linux'

Electron Forge was terminated. Location:
{}

3. Set the make platform option to win32

4. exec npm run make

> electron-forge make --platform=win32

✔ Checking your system
✔ Resolving Forge Config
We need to package your application before we can make it
✔ Preparing to Package Application for arch: x64
✔ Preparing native dependencies
✔ Packaging Application
Making for the following targets: squirrel
✖ Making for target: squirrel - On platform: win32 - For arch: x64

An unhandled error has occurred inside Forge:
An error occured while making for target: squirrel
Failed with exit code: 255
Output:
System.AggregateException: One or more errors occurred. () ---> System.Exception
  at Squirrel.Utility.CreateZipFromDirectory (System.String zipFilePath, System.String inFolder) [0x00119] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <b27839cc2dba4804baacf2f5cce6de32>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <b27839cc2dba4804baacf2f5cce6de32>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <b27839cc2dba4804baacf2f5cce6de32>:0 
  at Squirrel.ReleasePackage.CreateReleasePackage (System.String outputFile, System.String packagesRootDir, System.Func`2[T,TResult] releaseNotesProcessor, System.Action`1[T] contentsPostProcessHook) [0x001f7] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
  at Squirrel.Update.Program.Releasify (System.String package, System.String targetDir, System.String packagesDir, System.String bootstrapperExe, System.String backgroundGif, System.String signingOpts, System.String baseUrl, System.String setupIcon, System.Boolean generateMsi, System.Boolean packageAs64Bit, System.String frameworkVersion, System.Boolean generateDeltas) [0x00214] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
  at Squirrel.Update.Program.executeCommandLine (System.String[] args) [0x00116] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
  at Squirrel.Update.Program.main (System.String[] args) [0x00113] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
  at Squirrel.Update.Program.Main (System.String[] args) [0x00006] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
---> (Inner Exception #0) System.Exception
  at Squirrel.Utility.CreateZipFromDirectory (System.String zipFilePath, System.String inFolder) [0x00119] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 <---

Error: Failed with exit code: 255
Output:
System.AggregateException: One or more errors occurred. () ---> System.Exception
  at Squirrel.Utility.CreateZipFromDirectory (System.String zipFilePath, System.String inFolder) [0x00119] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <b27839cc2dba4804baacf2f5cce6de32>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <b27839cc2dba4804baacf2f5cce6de32>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <b27839cc2dba4804baacf2f5cce6de32>:0 
  at Squirrel.ReleasePackage.CreateReleasePackage (System.String outputFile, System.String packagesRootDir, System.Func`2[T,TResult] releaseNotesProcessor, System.Action`1[T] contentsPostProcessHook) [0x001f7] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
  at Squirrel.Update.Program.Releasify (System.String package, System.String targetDir, System.String packagesDir, System.String bootstrapperExe, System.String backgroundGif, System.String signingOpts, System.String baseUrl, System.String setupIcon, System.Boolean generateMsi, System.Boolean packageAs64Bit, System.String frameworkVersion, System.Boolean generateDeltas) [0x00214] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
  at Squirrel.Update.Program.executeCommandLine (System.String[] args) [0x00116] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
  at Squirrel.Update.Program.main (System.String[] args) [0x00113] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
  at Squirrel.Update.Program.Main (System.String[] args) [0x00006] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 
---> (Inner Exception #0) System.Exception
  at Squirrel.Utility.CreateZipFromDirectory (System.String zipFilePath, System.String inFolder) [0x00119] in <1ffb1a5dca5b4f2f93386cec56fd9ec2>:0 <---

    at ChildProcess.<anonymous> (/Users/chudong/workBench/anyrtc/anyrtc-products/quick-talk-pro-electron/node_modules/electron-winstaller/lib/spawn-promise.js:49:24)
    at ChildProcess.emit (events.js:400:28)
    at ChildProcess.emit (domain.js:475:12)
    at maybeClose (internal/child_process.js:1088:16)
    at Socket.<anonymous> (internal/child_process.js:446:11)
    at Socket.emit (events.js:412:35)
    at Socket.emit (domain.js:475:12)
    at Pipe.<anonymous> (net.js:686:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! quick-talk-pro-electron@1.0.0 make: `electron-forge make --platform=win32`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the quick-talk-pro-electron@1.0.0 make script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/chudong/.npm/_logs/2022-08-18T01_56_22_230Z-debug.log

Additional information

I have install Mono(v6.12.0.182) and wine-stable(v7.0) on my MBP.

debug log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/chudong/.nvm/versions/node/v14.20.0/bin/node',
1 verbose cli   '/Users/chudong/.nvm/versions/node/v14.20.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'make'
1 verbose cli ]
2 info using npm@6.14.17
3 info using node@v14.20.0
4 verbose run-script [ 'premake', 'make', 'postmake' ]
5 info lifecycle quick-talk-pro-electron@1.0.0~premake: quick-talk-pro-electron@1.0.0
6 info lifecycle quick-talk-pro-electron@1.0.0~make: quick-talk-pro-electron@1.0.0
7 verbose lifecycle quick-talk-pro-electron@1.0.0~make: unsafe-perm in lifecycle true
8 verbose lifecycle quick-talk-pro-electron@1.0.0~make: PATH: /Users/chudong/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/chudong/workBench/anyrtc/anyrtc-products/quick-talk-pro-electron/node_modules/.bin:/Users/chudong/.nvm/versions/node/v14.20.0/bin:/Users/chudong/.nvm/versions/node/v14.16.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/chudong/.nvm/versions/node/v14.16.0/bin:/Users/chudong/.cargo/bin
9 verbose lifecycle quick-talk-pro-electron@1.0.0~make: CWD: /Users/chudong/workBench/anyrtc/anyrtc-products/quick-talk-pro-electron
10 silly lifecycle quick-talk-pro-electron@1.0.0~make: Args: [ '-c', 'electron-forge make --platform=win32' ]
11 silly lifecycle quick-talk-pro-electron@1.0.0~make: Returned: code: 1  signal: null
12 info lifecycle quick-talk-pro-electron@1.0.0~make: Failed to exec make script
13 verbose stack Error: quick-talk-pro-electron@1.0.0 make: `electron-forge make --platform=win32`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/chudong/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:400:28)
13 verbose stack     at ChildProcess.<anonymous> (/Users/chudong/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:400:28)
13 verbose stack     at maybeClose (internal/child_process.js:1088:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
14 verbose pkgid quick-talk-pro-electron@1.0.0
15 verbose cwd /Users/chudong/workBench/anyrtc/anyrtc-products/quick-talk-pro-electron
16 verbose Darwin 19.6.0
17 verbose argv "/Users/chudong/.nvm/versions/node/v14.20.0/bin/node" "/Users/chudong/.nvm/versions/node/v14.20.0/bin/npm" "run" "make"
18 verbose node v14.20.0
19 verbose npm  v6.14.17
20 error code ELIFECYCLE
21 error errno 1
22 error quick-talk-pro-electron@1.0.0 make: `electron-forge make --platform=win32`
22 error Exit status 1
23 error Failed at the quick-talk-pro-electron@1.0.0 make script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
VerteDinde commented 2 years ago

@chudongvip It's not currently possible to make an installer for one platform on a different host platform (i.e. making a Windows installer on Mac), so this is unfortunately expected. You can read more about maker options here: https://www.electronforge.io/config/makers

Similarly, "all" isn't a valid platform option. When making a publisher, platform is set to all options by default, and you only need to specify which ones if you want to isolate for those specifically. For makers, the platform options are ['darwin', 'mas', 'win32', 'linux'].

Hope this helps! Let me know if you have other questions, we can also update the docs to make this more clear if that would be helpful.

chudongvip commented 2 years ago

Thanks bro. It means I can packing for one platform on a different host platform, and can not make an installer?