electron / forge

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

"Cannot read property 'succeed' of undefined" occurs when packaging darwin targets on windows host #331

Closed icoxfog417 closed 6 years ago

icoxfog417 commented 7 years ago

I could find out the #67 but it is so old version.

Please describe your issue:

When I execute the make for Mac(darwin), "Cannot read property 'succeed' of undefined" occurred.

Environment

*Console output when you run electron-forge with the environment variable `DEBUG=electron-forge:`. (Instructions on how to do so here). Please include the stack trace if one exists.**

set DEBUG=electron-forge:* & electron-forge make -p darwin --target=zip
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +973ms
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Resolving Forge Config +0ms
  electron-forge:project-resolver searching for project in: C:\Users\ico\Documents\works\developers-stop-watch +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in C:\Users\ico\Documents\works\developers-stop-watch\package.json +9ms
  electron-forge:lifecycle Process Succeeded: Resolving Forge Config +27ms
  electron-forge:require-search searching [ '../makers/darwin/zip.js',
  '../makers/generic/zip.js',
  'electron-forge-maker-zip',
  'zip',
  'C:\\Users\\ico\\Documents\\works\\developers-stop-watch\\zip',
  'C:\\Users\\ico\\Documents\\works\\developers-stop-watch\\node_modules\\zip',
  'C:\\Users\\ico\\AppData\\Roaming\\npm\\node_modules\\electron-forge\\dist\\makers\\darwin\\zip.js',
  'C:\\Users\\ico\\AppData\\Roaming\\npm\\node_modules\\electron-forge\\dist\\makers\\generic\\zip.js',
  'C:\\Users\\ico\\AppData\\Roaming\\npm\\node_modules\\electron-forge\\dist\\api\\electron-forge-maker-zip',
  'C:\\Users\\ico\\AppData\\Roaming\\npm\\node_modules\\electron-forge\\dist\\api\\zip',
  'C:\\Users\\ico\\Documents\\works\\developers-stop-watch\\zip',
  'C:\\Users\\ico\\Documents\\works\\developers-stop-watch\\node_modules\\zip',
  'C:\\Users\\ico\\AppData\\Roaming\\npm\\node_modules\\electron-forge\\dist\\api\\makers\\darwin\\zip.js',
  'C:\\Users\\ico\\AppData\\Roaming\\npm\\node_modules\\electron-forge\\dist\\api\\makers\\generic\\zip.js',
  'C:\\Users\\ico\\AppData\\Roaming\\npm\\node_modules\\electron-forge\\dist\\api\\node_modules\\electron-forge-maker-zip',
  'C:\\Users\\ico\\AppData\\Roaming\\npm\\node_modules\\electron-forge\\dist\\api\\node_modules\\zip',
  'C:\\Users\\ico\\Documents\\works\\developers-stop-watch\\zip',
  'C:\\Users\\ico\\Documents\\works\\developers-stop-watch\\node_modules\\zip' ] relative to C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\dist\api +0ms
  electron-forge:require-search testing ../makers/darwin/zip.js +13ms
  electron-forge:require-search testing ../makers/generic/zip.js +22ms
We need to package your application before we can make it
  electron-forge:lifecycle Process Started: Preparing to Package Application for arch: x64 +63ms
  electron-forge:project-resolver searching for project in: C:\Users\ico\Documents\works\developers-stop-watch +90ms
  electron-forge:project-resolver electron-forge compatible package.json found in C:\Users\ico\Documents\works\developers-stop-watch\package.json +21ms
  electron-forge:hook could not find hook: generateAssets +0ms
  electron-forge:hook could not find hook: prePackage +3ms
  electron-forge:packager packaging with options { asar: false,
  overwrite: true,
  afterCopy: [ [Function], [Function], [Function], [Function] ],
  afterExtract: [],
  dir: 'C:\\Users\\ico\\Documents\\works\\developers-stop-watch',
  arch: 'x64',
  platform: 'darwin',
  out: 'C:\\Users\\ico\\Documents\\works\\developers-stop-watch\\out',
  electronVersion: '1.7.6',
  quiet: true } +0ms
  electron-forge:hook could not find hook: postPackage +368ms

An unhandled rejection has occurred inside Forge:
Cannot read property 'succeed' of undefined
TypeError: Cannot read property 'succeed' of undefined
    at _callee5$ (C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\dist\api\package.js:388:28)
    at tryCatch (C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\node_modules\regenerator-runtime\runtime.js:65:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\node_modules\regenerator-runtime\runtime.js:299:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\node_modules\regenerator-runtime\runtime.js:117:21)
    at GeneratorFunctionPrototype.tryCatcher (C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\util.js:16:23)
    at PromiseSpawn._promiseFulfilled (C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\generators.js:97:49)
    at Async._drainQueue (C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:138:12)
    at Async._drainQueues (C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (C:\Users\ico\AppData\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

What command line arguments are you passing?

electron-forge make -p darwin --target=zip

What does your config.forge data in package.json look like?

"config": {
    "forge": {
      "make_targets": {
        "win32": [
          "zip"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {},
      "electronWinstallerConfig": {
        "name": ""
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": ""
      }
    }
  }
malept commented 7 years ago

Perhaps try installing the Forge from the pull request https://github.com/electron-userland/electron-forge/pull/325 ? You can do so by:

  1. git clone https://github.com/electron-userland/electron-forge
  2. cd electron-forge and make a note of this path
  3. git checkout use-cross-zip
  4. npm install
  5. npm run build
  6. In your app, set the electron-forge version in your project's package.json devDependencies to the path from step 2
  7. From your app's directory, run npm run package -- --platform=darwin --target=zip
cosmo0 commented 6 years ago

Same here, even without specifying the arch.

.\node_modules\.bin\electron-forge package --platform=darwin
√ Checking your system
| Preparing to Package Application for arch: x64
An unhandled rejection has occurred inside Forge:
Cannot read property 'succeed' of undefined
TypeError: Cannot read property 'succeed' of undefined
    at D:\Perso\retropie-arcade-manager\node_modules\electron-forge\dist\api\package.js:315:21
    at Generator.next (<anonymous>)
    at Generator.tryCatcher (D:\Perso\retropie-arcade-manager\node_modules\bluebird\js\release\util.js:16:23)
    at PromiseSpawn._promiseFulfilled (D:\Perso\retropie-arcade-manager\node_modules\bluebird\js\release\generators.js:97:49)
    at Async._drainQueue (D:\Perso\retropie-arcade-manager\node_modules\bluebird\js\release\async.js:138:12)
    at Async._drainQueues (D:\Perso\retropie-arcade-manager\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\Perso\retropie-arcade-manager\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)

I have just added the electron-forge package like 5 minutes ago with npm i -D electron-forge.

package.json: (why is electron-compile in dependencies and not devDependencies?)

 "dependencies": {
    "csv": "^2.0.0",
    "electron-compile": "^6.4.2",
    "electron-squirrel-startup": "^1.0.0",
    "fs-extra": "^5.0.0"
  },
  "devDependencies": {
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "electron-forge": "^5.1.2",
    "electron-prebuilt-compile": "1.8.4",
    "gulp": "^3.9.1"
  },
  "config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {
        "packageManager": "npm"
      },
      "electronWinstallerConfig": {
        "name": "Retropie Arcade Manager"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": "",
        "name": "Retropie Arcade Manager"
      }
    }
  }

Not specifying a platform (so it builds a Windows package) works fine. --platform=linux also works fine.

malept commented 6 years ago

@cosmo0 can you please try the instructions in https://github.com/electron-userland/electron-forge/issues/331#issuecomment-331773002 and see if that works for you?

cosmo0 commented 6 years ago

Still no luck :(

package.json:

  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make"
  },
  "dependencies": {
    "csv": "^2.0.0",
    "fs-extra": "^5.0.0",
    "electron-compile": "^6.4.2",
    "electron-squirrel-startup": "^1.0.0"
  },
  "devDependencies": {
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "electron-forge": "D:/Perso/electron-forge",
    "electron-prebuilt-compile": "1.8.4"
  },
  "config": {
    "forge": {
      "make_targets": {
        "win32": [
          "zip"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      }
    }
  }

Console output:

>> npm run make -- --platform=darwin --target=zip

> retropie-arcade-manager@1.0.0 make D:\Perso\retropie-arcade-manager
> electron-forge make "--platform=darwin" "--target=zip"

√ Checking your system
√ Resolving Forge Config
We need to package your application before we can make it
\ Preparing to Package Application for arch: x64
An unhandled rejection has occurred inside Forge:
Cannot read property 'succeed' of undefined
TypeError: Cannot read property 'succeed' of undefined
    at D:\Perso\electron-forge\dist\api\package.js:315:21
    at Generator.next (<anonymous>)
    at Generator.tryCatcher (D:\Perso\electron-forge\node_modules\bluebird\js\release\util.js:16:23)
    at PromiseSpawn._promiseFulfilled (D:\Perso\electron-forge\node_modules\bluebird\js\release\generators.js:97:49)
    at Async._drainQueue (D:\Perso\electron-forge\node_modules\bluebird\js\release\async.js:138:12)
    at Async._drainQueues (D:\Perso\electron-forge\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\Perso\electron-forge\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)

log:

0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files (x86)\nodejs\node.exe', 1 verbose cli 'C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'make', 1 verbose cli '--', 1 verbose cli '--platform=darwin', 1 verbose cli '--target=zip' ] 2 info using npm@5.8.0 3 info using node@v9.8.0 4 verbose run-script [ 'premake', 'make', 'postmake' ] 5 info lifecycle retropie-arcade-manager@1.0.0~premake: retropie-arcade-manager@1.0.0 6 info lifecycle retropie-arcade-manager@1.0.0~make: retropie-arcade-manager@1.0.0 7 verbose lifecycle retropie-arcade-manager@1.0.0~make: unsafe-perm in lifecycle true 8 verbose lifecycle retropie-arcade-manager@1.0.0~make: PATH: C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Perso\retropie-arcade-manager\node_modules.bin;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;C:\windows;C:\windows\system32;C:\windows\system32\inetsrv;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files\TortoiseSVN\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;D:\Mongodb\bin;C:\Program Files (x86)\nodejs;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\dotnet\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\Python27;C:\Program Files (x86)\nodejs\;C:\Program Files\TortoiseGit\bin;C:\Users\xxx\AppData\Local\scoop\shims;C:\Program Files\Git\usr\bin;.bin;C:\Program Files\Mercurial\;D:\DEV\tools\sonarqube\scanner\bin;C:\Program Files\Microsoft VS Code\bin;C:\Users\xxx\AppData\Local\Programs\Fiddler;C:\Users\xxx\AppData\Roaming\npm 9 verbose lifecycle retropie-arcade-manager@1.0.0~make: CWD: D:\Perso\retropie-arcade-manager 10 silly lifecycle retropie-arcade-manager@1.0.0~make: Args: [ '/d /s /c', 10 silly lifecycle 'electron-forge make "--platform=darwin" "--target=zip"' ] 11 silly lifecycle retropie-arcade-manager@1.0.0~make: Returned: code: 1 signal: null 12 info lifecycle retropie-arcade-manager@1.0.0~make: Failed to exec make script 13 verbose stack Error: retropie-arcade-manager@1.0.0 make: electron-forge make "--platform=darwin" "--target=zip" 13 verbose stack Exit status 1 13 verbose stack at EventEmitter. (C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:283:16) 13 verbose stack at EventEmitter.emit (events.js:180:13) 13 verbose stack at ChildProcess. (C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:180:13) 13 verbose stack at maybeClose (internal/child_process.js:936:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5) 14 verbose pkgid retropie-arcade-manager@1.0.0 15 verbose cwd D:\Perso\retropie-arcade-manager 16 verbose Windows_NT 6.3.9600 17 verbose argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "make" "--" "--platform=darwin" "--target=zip" 18 verbose node v9.8.0 19 verbose npm v5.8.0 20 error code ELIFECYCLE 21 error errno 1 22 error retropie-arcade-manager@1.0.0 make: electron-forge make "--platform=darwin" "--target=zip" 22 error Exit status 1 23 error Failed at the retropie-arcade-manager@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 ]

MarshallOfSound commented 6 years ago

I'm going to close this out given #475 and #434. Also this is almost certainly handle in V6 or typescript would be complaining to us 😄

rguryanov commented 5 years ago

Spent an hour on that error. Pretty sure it happens because electron-packager need create Symlinks for macos package and on windows you need admin rights for that. Run from cmd as admin worked for me. Error message from electron-packager not shown because electron-forge run electron-packager in "quiet mode".

Related issues - https://github.com/electron-userland/electron-packager/issues/71 https://github.com/electron-userland/electron-packager/issues/164

related code in electron-packager https://github.com/electron-userland/electron-packager/blob/v13.1.1/index.js#L35 https://github.com/electron-userland/electron-packager/blob/v13.1.1/index.js#L57

Maybe it worth to make same symlink checking...

kethan1 commented 3 years ago

@rguryanov Thank you soooo much!! Helped me a lot!