require() of ES Module not supported.
See original GitHub issueDescribe the bug

There might be a way around this that I’m just not familiar with, but vitest appears to fail when any of your node dependencies use require, which I feel is untenable.
Reproduction
Importing Adaptable in any class and then running a test which tests this class.
System Info
System:
OS: Windows 10 10.0.19042
CPU: (12) x64 Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz
Memory: 13.22 GB / 31.71 GB
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 97.0.4692.71
Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.62)
Internet Explorer: 11.0.19041.1202
npmPackages:
@vitejs/plugin-react-refresh: ^1.3.6 => 1.3.6
vite: ^2.7.2 => 2.7.12
vitest: ^0.1.18 => 0.1.18
Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
The node-fetch latest version doesn't use the require() syntax to import the package. You need to go to your package.json and type
Read more >Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
The error [ERR_REQUIRE_ESM]: require() of ES Module not supported. Instead change the require of index.js to a dynamic import() which is available in...
Read more >require() of ES modules is not supported · Issue #43833 - GitHub
angular\compiler-cli\bundles\index.js require() of ES modules is not supported. When I try to run Jest test I get:
Read more >require() of es module is not supported - You.com - You.com
The current version of node-fetch is ONLY compatible with an ESM import (using import ), not from CommonJS modules using require() . You...
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
Using require to load an ES module is not supported because ES modules have asynchronous execution. Instead, use import() to load an ES...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have checked is briefly. Not sure what is wrong in this particular case but
@adaptabletools/adaptablepackage is just really messed up. Bothmainandtypingsfields are incorrect inpackage.json. Library is in CommonJs format and imports from ESM package using require. https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c - here is the explanation why ESM packages cannot be required. So I can only assume there is something wrong with their build.Yes, their
Adaptable.jsis CJS module that usesrequireto load ESM module, which is not supported by native Node.