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

fix: Error ERR_REQUIRE_ESM - require() of ES Module not supported #237

Open
42atomys opened this issue Mar 8, 2024 · 3 comments
Open

fix: Error ERR_REQUIRE_ESM - require() of ES Module not supported #237

42atomys opened this issue Mar 8, 2024 · 3 comments

Comments

@42atomys
Copy link

42atomys commented Mar 8, 2024

Hello since today any workflow with pull-request-name-linter-action cransh with this error

Error: Error [ERR_REQUIRE_ESM]: 
require() of ES Module /home/runner/work/repo/node_modules/@commitlint/config-conventional/lib/index.js from /home/runner/work/_actions/JulienKode/pull-request-name-linter-action/v0.5.0/dist/index.js not supported.
Instead change the require of /home/runner/work/repo/node_modules/@commitlint/config-conventional/lib/index.js in /home/runner/work/_actions/JulienKode/pull-request-name-linter-action/v0.[5](https://github.com/org/repo/actions/runs/8197591753/job/22419784725?pr=21#step:4:6).0/dist/index.js to a dynamic import() which is available in all CommonJS modules.
Error: require() of ES Module /home/runner/work/repo/node_modules/@commitlint/config-conventional/lib/index.js from /home/runner/work/_actions/JulienKode/pull-request-name-linter-action/v0.5.0/dist/index.js not supported.
Instead change the require of /home/runner/work/repo/node_modules/@commitlint/config-conventional/lib/index.js in /home/runner/work/_actions/JulienKode/pull-request-name-linter-action/v0.5.0/dist/index.js to a dynamic import() which is available in all CommonJS modules.
@techMedMau
Copy link

Encounter this issue too. Has anyone been able to solved the issue?

@leonardo-santana-c4u
Copy link

Running into the same issue

@paulsmir
Copy link

paulsmir commented Sep 2, 2024

To fix the require() of ES Module error with @commitlint/config-conventional, specify version 16.0.0 in your workflow. As detailed here, you can resolve the issue by running:

name: test-pull-request-name
on:
  pull_request:
    types: ["opened", "edited", "reopened", "synchronize"]

jobs:
  pr-lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install Dependencies
        run: npm install @commitlint/[email protected]
      - uses: JulienKode/[email protected]

This version ensures compatibility and avoids ESM-related problems.

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

4 participants