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

@commitlint/config-nx-scopes | Error [ERR_REQUIRE_ESM]: require() of ES Module Not Supported #3948

Closed
4 tasks
apurvaojas opened this issue Mar 4, 2024 · 2 comments · Fixed by #3953
Closed
4 tasks

Comments

@apurvaojas
Copy link

apurvaojas commented Mar 4, 2024

Steps to Reproduce

1. Node >= 18
2. Using `@commitlint/config-nx-scopes`
3. Throwing error

(node:35973) [DEP0151] DeprecationWarning: No "main" or "exports" field defined in the package.json for /.../../node_modules/@commitlint/config-nx-scopes/ resolving the main entry point "index.js", imported from /.../../.commitlintrc.js.
Default "index" lookups for the main are deprecated for ES modules.

In package.json of @commitlint/config-nx-scopes

{
  "name": "@commitlint/config-nx-scopes",
  "type": "module", // ==> Module Defined but no main or exports defined
  "version": "19.0.3",
  "description": "Shareable commitlint config enforcing nx project names as scopes",
  "files": [
    "index.js"
  ]
}

Current Behavior

No response

Expected Behavior

Should work, without throwing errors.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

No response

Context

No response

commitlint --version

@commitlint/cli@19.0.3

git --version

2.34.1

node --version

v18.19.0

@apurvaojas apurvaojas added the bug label Mar 4, 2024
@apurvaojas apurvaojas changed the title fix: <title> @commitlint/config-nx-scopes | Error [ERR_REQUIRE_ESM]: require() of ES Module Not Supported Mar 4, 2024
@DMaiGit
Copy link

DMaiGit commented Mar 4, 2024

The new version has the same error, and the downgraded version to version 17.4.2 can be used normally, but I am sorry that other versions have not been tested

@DenisHdz
Copy link

DenisHdz commented Mar 4, 2024

Same was happening to me, but I've removed the node_modules folder, run pnpm install and now I don't get the error message when committing.

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

Successfully merging a pull request may close this issue.

4 participants