electron-userland / electron-forge-templates

Templates bundled with Electron Forge <= 5 to create Electron apps using popular JavaScript frameworks
107 stars 23 forks source link

React Template - UnhandledPromiseRejectionWarning: Error: spawn unzip ENOENT #63

Closed polarathene closed 5 years ago

polarathene commented 5 years ago

version 5.2.4 of electron-forge

I don't think I need to say too much about this as below info should be enough? Fresh React template is raising this error on start, I have another one after installing a few node modules(from a different electron react project that works fine that did not use forge), that raises a different error.

I've compared it to initializing a project without the React template specified, there are some differences (mainly the React project pulls in an extra babel plugin for es2015 classes, and .compilerc specifies electron 1.6 vs no templates 4.0). Perhaps the template is just out of date?

Any other info you'd like?

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

[me@linux projects]$ electron-forge init myproject --template=react
✔ Checking your system
✔ Initializing Project Directory
✔ Initializing Git Repository
✔ Copying Starter Files
✔ Initializing NPM Module
✔ Installing NPM Dependencies
✔ Locating custom template: "react"
✔ Installing Template Dependencies
✔ Copying Template Files
[me@linux projects]$ electron-forge start
✔ Checking your system
(node:20663) UnhandledPromiseRejectionWarning: Error: spawn unzip ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:20663) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:20663) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
DEBUG=electron-forge:* electron-forge start
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 +369ms
  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: Locating Application +0ms
  electron-forge:project-resolver searching for project in: /storage/projects/forge/myproject +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /storage/projects/forge/myproject/package.json +5ms
  electron-forge:lifecycle Process Succeeded: Locating Application +7ms
  electron-forge:lifecycle Process Started: Preparing native dependencies +4ms
  electron-forge:lifecycle Process Succeeded: Preparing native dependencies +216ms
  electron-forge:hook could not find hook: generateAssets +0ms
  electron-forge:lifecycle Process Started: Launching Application +1ms
  electron-forge:lifecycle Process Succeeded: Launching Application +3ms
(node:21092) UnhandledPromiseRejectionWarning: Error: spawn unzip ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:21092) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21092) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

What command line arguments are you passing?

Followed [official site template instructions(]https://electronforge.io/templates) for React

npm install -g electron-forge
electron-forge init myproject --template=react
cd my-new-project
electron-forge start

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

"config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {
        "packageManager": "yarn"
      },
      "electronWinstallerConfig": {
        "name": "myproject"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": "",
        "name": "myproject"
      }
    }
  },
polarathene commented 5 years ago

Repeat above process, but also run:

npm install --save styled-components styled-modern-normalize babel-plugin-styled-components bluebird google-tts-api lodash moize react-icons

Then:

$ electron-forge start
✔ Checking your system
✔ Locating Application
✔ Preparing native dependencies
✔ Launching Application
App threw an error during load
ReferenceError: Unknown plugin "react-hot-loader/babel" specified in "base" at 2, attempted to resolve relative to "/storage/projects/forge/read-aloud/src"
    at /storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at Pipeline.transform (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at BabelCompiler.compileSync (/storage/projects/forge/read-aloud/node_modules/electron-compilers/lib/js/babel.js:81:26)
    at CompilerHost.compileUncachedSync (/storage/projects/forge/read-aloud/node_modules/electron-prebuilt-compile/node_modules/electron-compile/lib/compiler-host.js:669:27)
A JavaScript error occurred in the main process
Uncaught Exception:
// Exact repeat of the above output

and with DEBUG:

DEBUG=electron-forge:* electron-forge start
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 +348ms
  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: Locating Application +0ms
  electron-forge:project-resolver searching for project in: /storage/projects/forge/read-aloud +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /storage/projects/forge/read-aloud/package.json +8ms
  electron-forge:lifecycle Process Succeeded: Locating Application +9ms
  electron-forge:lifecycle Process Started: Preparing native dependencies +7ms
  electron-forge:lifecycle Process Succeeded: Preparing native dependencies +1s
  electron-forge:hook could not find hook: generateAssets +0ms
  electron-forge:lifecycle Process Started: Launching Application +2ms
  electron-forge:lifecycle Process Succeeded: Launching Application +9ms
App threw an error during load
ReferenceError: Unknown plugin "react-hot-loader/babel" specified in "base" at 2, attempted to resolve relative to "/storage/projects/forge/read-aloud/src"
    at /storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at Pipeline.transform (/storage/projects/forge/read-aloud/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at BabelCompiler.compileSync (/storage/projects/forge/read-aloud/node_modules/electron-compilers/lib/js/babel.js:81:26)
    at CompilerHost.compileUncachedSync (/storage/projects/forge/read-aloud/node_modules/electron-prebuilt-compile/node_modules/electron-compile/lib/compiler-host.js:669:27)
A JavaScript error occurred in the main process
Uncaught Exception:
polarathene commented 5 years ago

I'm thinking by going over my package.json and the react template package.json in this repo, that it's really not clear what this template is doing that's making it a React template?

It's not pulling in React at all? react-hot-loader/babel is mentioned here though(.compilerc) and I guess is where the error is stemming from? I see react was installed in node_modules, and I guess that file is where it's requesting react dependencies as I don't see them anywhere else?

react-hot-loader/babel, if this is referring to relative path in node_modules directory, there is no babel folder there, it's living in lib, so react-hot-loader/lib/babel.

Is one of my dependencies causing this breakage for some reason? If so is it due to something out of date with this template(babel perhaps?). I haven't added my own code yet just added packages.

DefiCake commented 5 years ago

Uh, the template is completely broken and the repository has not been updated in 2 years. Is this project dead?

polarathene commented 5 years ago

@rrodriguezreche I had a much better time with electron-builder, I'd suggest that over forge tbh.

bluebrown commented 5 years ago

Not sure if its related but I get this error: react_error

malept commented 5 years ago

Closing, see https://github.com/electron-userland/electron-forge-templates/issues/66