question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[6.0.0-beta.54] NPM v7 causing error on launch

See original GitHub issue

Preflight Checklist

  • 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 a bug that matches the one I want to file, without success.

Issue Details

I’ve experienced an issue using NPM v7 with a fresh Electron Forge project (TypeScript + WebPack variant). The project is created successfully, but on launch I receive the below error apparently originating from html-webpack-plugin.

I can confirm the error does not occur when I use Yarn, or when I revert to NPM v6 (I tried 6.14.10). What is happening?

  • Electron Forge Version:
    • 6.0.0-beta.54
  • Electron Version:
    • 11.1.0
  • Operating System:
    • macOS 10.15.7 (19H15)
  • Last Known Working Electron Forge version::
    • N/A

Expected Behavior

The application should load without any error

Actual Behavior

Application fails to load due to error below.

To Reproduce

  • Install NPM 7.3.0
  • npx create-electron-app my-new-app --template=typescript-webpack
  • Run the application
  • Experience the error
  • If the error does not happen, remove the node_modules and package-lock.json and reinstall and run (error should occur)

Additional Information

Error log

> my-new-app@1.0.0 start
> electron-forge start

✔ Checking your system
✔ Locating Application
✔ Preparing native dependencies
✔ Compiling Main Process Code
✔ Launch Dev Servers
✔ Compiling Preload Scripts

An unhandled rejection has occurred inside Forge:
TypeError: Cannot read property 'createSnapshot' of undefined
    at /Users/abc/Desktop/my-new-app/node_modules/html-webpack-plugin/lib/webpack5/file-watcher-api.js:13:36
    at new Promise (<anonymous>)
    at Object.createSnapshot (/Users/abc/Desktop/my-new-app/node_modules/html-webpack-plugin/lib/webpack5/file-watcher-api.js:12:10)
    at /Users/abc/Desktop/my-new-app/node_modules/html-webpack-plugin/lib/cached-child-compiler.js:219:35
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Electron Forge was terminated. Location:
{}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:12
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
simonh1000commented, Apr 1, 2021

npm install --legacy-peer-deps was how I got around this for the time being

1reaction
feljxcommented, Feb 19, 2021

Duplicate of #1998 Switch to NPM 6 (node 14.15.5) for project generation with create-electron-app, then switch back. Related to webpack 4 dependency in webpack plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[6.0.0-beta.54] NPM v7 causing error on launch #2101 - GitHub
I've experienced an issue using NPM v7 with a fresh Electron Forge project (TypeScript + WebPack variant). The project is created successfully, ...
Read more >
Common errors | npm Docs
Possible temporary npm registry glitch, or corrupted local server cache. Run npm cache clean and/or try again later. This can be caused by...
Read more >
Electron Forge v6, Keytar & Node-Loader Error "no suitable ...
I am having some trouble getting the Keytar package working in an Electron Forge v6 project (beta.54).
Read more >
npm fails to install - Google Groups
Getting a rather long error when trying to run sudo npm install -g appium ... Or are you trying to launch an Appium\nserver...
Read more >
npm 7 is now generally available! - The GitHub Blog
In previous versions of npm (4-6), peer dependencies conflicts presented a warning that versions were not compatible, but would still install ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found