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

plugin-electronegativity error: "warn: Couldn't detect Electron version, assuming v0.1.0" #2818

Closed
3 tasks done
guizmaii opened this issue Apr 22, 2022 · 1 comment · Fixed by #3007
Closed
3 tasks done

Comments

@guizmaii
Copy link

Pre-flight checklist

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

Electron Forge version

6.0.0-beta.63

Electron version

v18.1.0

Operating system

Ubuntu 20.04.4 / macOS 11.6.5 / Microsoft Windows Server 2022 10.0.20348

Last known working Electron Forge version

No response

Expected behavior

The Electron version must be auto-detected

Actual behavior

I configured the plugin-electronegativity in a brand new generated Electron+TS+Wepback project (thanks to https://www.electronforge.io/templates/typescript-+-webpack-template), following the plugin doc: https://www.electronforge.io/config/plugins/electronegativity

In my CI, running on Mac, Windows and Linux, when I run yarn make I have the following error:

warn: Couldn't detect Electron version, assuming v0.1.0. Defaults have probably changed for your actual version, please check manually.

Steps to reproduce

Additional information

No response

@erikian
Copy link
Member

erikian commented Aug 6, 2022

The Webpack plugin modifies the original package.json, setting devDependencies (as well as dependencies/optionalDependencies/peerDependencies) to an empty object here:

pj.devDependencies = {};
pj.dependencies = {};
pj.optionalDependencies = {};
pj.peerDependencies = {};

When @doyensec/electronegativity attempts to read the Electron version from devDependencies, it finds none, hence the error.

I believe this could be fixed by simply not modifying the original package.json file. While removing dependencies from the distributed package.json can be desirable, plugins shouldn't really introduce any side effects like this one.

This behavior seems to exist just as an additional measure to prevent the whole node_modules directory to be packaged, as described in #593 (comment). But since the plugin already ignores anything outside the .webpack directory and does not call npm install, using the original package.json should be safe enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment