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

Problem with the version of node-fetch package in electron app #349

Closed
antoniovlx opened this issue Nov 18, 2022 · 1 comment
Closed

Problem with the version of node-fetch package in electron app #349

antoniovlx opened this issue Nov 18, 2022 · 1 comment

Comments

@antoniovlx
Copy link
Contributor

antoniovlx commented Nov 18, 2022

In section Electron Quirks is required to install node-fetch because the plugin uses it in an electron app.

I've installed the last version (3.3.0) and I get an error when I run the app:

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\anton\git\ionic-angular-template\electron\node_modules\node-fetch\src\index.js from C:\Users\anton\git\ionic-angular-template\electron\node_modules\@capacitor-community\sqlite\electron\dist\plugin.js not supported.

The node-fetch error "[ERR_REQUIRE_ESM]: require() not supported" occurs because the node-fetch package has been converted to be an ESM-only package in version 3, which means that the package can't be imported with require().

Solutions: use a dynamic import to import the node-fetch package in the library or downgrade the version of the package to 2.6.7, which is the last version that is built with CommonJS.

I think it's necessary to warn this scenario in the readme and indicate that the version installed of node-fech must be "<=2.6.7"

I can create a pull request in the readme file If you want.

@jepiqueau
Copy link
Collaborator

@antoniovlx OK thanks for your comment. Can you make a PR to modify the Electron Quirks and add you in the list of contributors in the readme.md file and i will merge the PR

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