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

[ERR_REQUIRE_ESM]: Must use import to load ES Module #772

Closed
schmetzyannick opened this issue Jul 22, 2021 · 3 comments
Closed

[ERR_REQUIRE_ESM]: Must use import to load ES Module #772

schmetzyannick opened this issue Jul 22, 2021 · 3 comments

Comments

@schmetzyannick
Copy link
Contributor

Expected behavior

Eslint runnning.
Last working version: 35.4.2

It seems to be related to the @es-joy\jsdoccomment update in the release 35.4.3.

Actual behavior

eslint . --ext .ts

Oops! Something went wrong! :(

ESLint: 7.30.0

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ...\node_modules\@es-joy\jsdoccomment\node_modules\comment-pa
rser\lib\parser\tokenizers\description.js
require() of ES modules is not supported.
require() of ...\node_modules\@es-joy\jsdoccomment\node_modules\comment-parser\lib\parser\tokenizers\description.js from
...\node_modules\@es-joy\jsdoccomment\dist\index.cjs.cjs is an ES module file as it is a .js file whose nearest parent pa
ckage.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename description.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from ...\node_modules\@es-joy\jsdoccomment\node_modules\comment-parser\package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1080:13)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (...\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at Object.<anonymous> (...\node_modules\@es-joy\jsdoccomment\dist\index.cjs.cjs:7:28)
    at Module._compile (...\qlikwrite_server\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)

ESLint Config

{
  "root": true,
  "plugins": [
    "jsdoc"
  ]
}

Environment

  • Node version: 14.16.0
  • ESLint version 7.30.0
  • eslint-plugin-jsdoc version: 35.5.0
@jessorlisa
Copy link

Same issue here. Last working version: 35.4.2

Environment:

  • Node version: 14.16.0
  • ESLint version 7.31.0

@gajus
Copy link
Owner

gajus commented Jul 22, 2021

🎉 This issue has been resolved in version 35.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Jul 22, 2021
@brettz9
Copy link
Collaborator

brettz9 commented Jul 22, 2021

Thanks for the report (and confirmation). Fixed in 35.5.1

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

No branches or pull requests

4 participants