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

[6.x] Create-electron-app with webpack template failing due to old Forge version installed #1009

Closed
3 tasks done
saltenhub opened this issue Jul 10, 2019 · 7 comments
Closed
3 tasks done

Comments

@saltenhub
Copy link

saltenhub commented Jul 10, 2019

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue:
Create-electron-app does not work for me when using the webpack template, neither with yarn nor npx.

npx:

➜  npx create-electron-app test1 --template=webpack
✔ Initializing Project Directory
✔ Initializing Git Repository
✔ Copying Starter Files
✔ Initializing NPM Module
✔ Installing NPM Dependencies
✖ Locating custom template: "webpack"

Electron forge was terminated:
Failed to locate custom template: "webpack"

Try `npm install -g @electron-forge-template-webpack`

yarn:

➜  yarn create electron-app --template=webpack test1
yarn create v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - create-electron-app
✔ Initializing Project Directory
✔ Initializing Git Repository
✔ Copying Starter Files
✔ Initializing NPM Module
✔ Installing NPM Dependencies
✖ Locating custom template: "webpack"

Electron forge was terminated:
Failed to locate custom template: "webpack"

Try `npm install -g @electron-forge-template-webpack`
error Command failed.
Exit code: 1

After installing @electron-forge/template-webpack globally and retrying, I got the following error:

➜  yarn create electron-app --template=webpack test1
yarn create v1.16.0
warning package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - create-electron-app
✔ Initializing Project Directory
✔ Initializing Git Repository
✔ Copying Starter Files
✔ Initializing NPM Module
✔ Installing NPM Dependencies
✔ Locating custom template: "webpack"

An unhandled rejection has occurred inside Forge:
Cannot find module 'source-map-support/register'
Error: Cannot find module 'source-map-support/register'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/xyz/code/node_modules/@electron-forge/template-webpack/dist/WebpackTemplate.js:8:1)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at require (/home/xyz/.config/yarn/global/node_modules/@electron-forge/core/src/api/init-scripts/init-custom.ts:46:55)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/home/xyz/.config/yarn/global/node_modules/@electron-forge/core/dist/api/init-scripts/init-custom.js:30:103)
    at _next (/home/xyz/.config/yarn/global/node_modules/@electron-forge/core/dist/api/init-scripts/init-custom.js:32:194)
error Command failed.
Exit code: 1
Command: /home/xyz/.yarn/bin/create-electron-app

Used versions:

  • node v10.16.0
  • npx v6.9.0
  • yarn v1.16.0

I worked around it by copying the files directly from Git, but wanted to check if anyone else can reconstruct this. Thanks!

@malept
Copy link
Member

malept commented Jul 10, 2019

I can't reproduce this on Linux with both npx 6.4.1 and npx 6.9.0:

$ npx --no-install --ignore-existing create-electron-app --template webpack forgepack
npx: installed 377 in 22.354s
✔ Initializing Project Directory
✔ Initializing Git Repository
✔ Copying Starter Files
✔ Initializing NPM Module
✔ Installing NPM Dependencies
✔ Locating custom template: "webpack"
✔ Installing Template Dependencies
✔ Setting up forge configuration
✔ Setting up webpack configuration

My best guess is that you have an old version of create-electron-app installed which points to Electron Forge v5. What do you get when you run npx create-electron-app --version ?

@saltenhub
Copy link
Author

I can't reproduce this on Linux with both npx 6.4.1 and npx 6.9.0:

$ npx --no-install --ignore-existing create-electron-app --template webpack forgepack
npx: installed 377 in 22.354s
✔ Initializing Project Directory
✔ Initializing Git Repository
✔ Copying Starter Files
✔ Initializing NPM Module
✔ Installing NPM Dependencies
✔ Locating custom template: "webpack"
✔ Installing Template Dependencies
✔ Setting up forge configuration
✔ Setting up webpack configuration

My best guess is that you have an old version of create-electron-app installed which points to Electron Forge v5. What do you get when you run npx create-electron-app --version ?

I get 6.0.0-beta.34

@malept
Copy link
Member

malept commented Jul 10, 2019

OK, that's still an old version (I believe the webpack template was added in beta 39). Try running npx --no-install --ignore-existing create-electron-app --template webpack my-electron-app

@malept malept changed the title [6.x] Create-electron-app with webpack template failing [6.x] Create-electron-app with webpack template failing due to old Forge version installed Jul 10, 2019
@saltenhub
Copy link
Author

I just made sure, that there are no global versions of electron-forge or create-electron-app installed (both in yarn and npm) and tried again with the command you provided but am still getting the same error as before:

➜  npx --no-install --ignore-existing create-electron-app --template webpack my-electron-app
npx: installed 377 in 8.815s
✔ Initializing Project Directory
✔ Initializing Git Repository
✔ Copying Starter Files
✔ Initializing NPM Module
✔ Installing NPM Dependencies
✔ Locating custom template: "webpack"

An unhandled rejection has occurred inside Forge:
{ Error: Cannot find module 'source-map-support/register'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/xyz/code/node_modules/@electron-forge/template-webpack/dist/WebpackTemplate.js:8:1)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at require (/home/xyz/.npm/_npx/5089/lib/node_modules/create-electron-app/node_modules/@electron-forge/core/src/api/init-scripts/init-custom.ts:45:55)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/home/xyz/.npm/_npx/5089/lib/node_modules/create-electron-app/node_modules/@electron-forge/core/dist/api/init-scripts/init-custom.js:22:103)
    at _next (/home/xyz/.npm/_npx/5089/lib/node_modules/create-electron-app/node_modules/@electron-forge/core/dist/api/init-scripts/init-custom.js:24:194) code: 'MODULE_NOT_FOUND' }

Electron Forge was terminated. Location:
{}

@malept
Copy link
Member

malept commented Jul 10, 2019

What OS is this?

@saltenhub
Copy link
Author

Fedora 30

@saltenhub
Copy link
Author

Okay, sorry to have bothered you - the issue was an orphaned node_modules folder in the folder I was trying to create the app in, which must have somehow interfered with the dependencies. I just deleted it and now it works like a charm. Thank you so much for your effort both in solving this and the project in general.

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

No branches or pull requests

2 participants