Skip to content

New error with 8.0.0? Error [ERR_REQUIRE_ESM]: require() of ES Module - How to resolve? #301

Open
@lyricnz

Description

@lyricnz
 Exception during run: Error [ERR_REQUIRE_ESM]: require() of ES Module $$SOMEDIR/node_modules/chai-as-promised/lib/chai-as-promised.js from $$SOMEDIR/test/drivers/driverInterface.spec.js not supported.
Instead change the require of chai-as-promised.js in $$SOMEDIR/test/drivers/driverInterface.spec.js to a dynamic import() which is available in all CommonJS modules.
    at require.extensions.<computed> [as .js] ($$SOMEDIR/node_modules/ts-node/dist/index.js:851:20)

But the quoted driverInterface.spec.js is built from a TS which is:

import * as chai from 'chai';
import chaiAsPromised from 'chai-as-promised';

chai.use(chaiAsPromised);

class RandomInstrumentedResource extends ToolingInterface {
....

Which bit of the code is wrong? (sorry, I'm maintaining a project, but didn't set up any of this TS/JS stuff)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions