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

An error occurred while running semantic-release: Error: Cannot find module 'xxxxx' with 4.1.0 #201

Open
Decklyn-Mac opened this issue Apr 4, 2024 · 4 comments

Comments

@Decklyn-Mac
Copy link

Decklyn-Mac commented Apr 4, 2024

Describe the bug

The issue I'm getting is that, with the 4.1.0 version I'm getting the above error where it cannot find the modules for conventional-changelog-conventionalcommits, I'm currently using github actions for this.

Workflow

My Github Actions workflow step is here

        - name: Semantic Release
          uses: cycjimmy/semantic-release-action@v4.1.0
          id: semantic   # Need an `id` for output variables
          with:
            branch: main
            extra_plugins: |
              conventional-changelog-conventionalcommits@6.1.0
              semantic-release-ms-teams@2.1.0
              aggregate-error@3.1.0
          env:
            GH_TOKEN: ${{ secrets.gh_access_token }}
            NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Here is the error

`Run cycjimmy/semantic-release-action@v4.1.0

added 351 packages, and audited 571 packages in 7s

97 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

[6:41:50 AM] [semantic-release] › ℹ Running semantic-release version 23.0.7
[6:41:50 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
[6:41:50 AM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/changelog"
[6:41:50 AM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[6:41:50 AM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[6:41:50 AM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/changelog"
[6:41:50 AM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
[6:41:50 AM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
[6:41:50 AM] [semantic-release] › ✔ Loaded plugin "success" from "@semantic-release/github"
[6:41:50 AM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/github"
[6:41:52 AM] [semantic-release] › ✔ Run automated release from branch main on repository https://github.com/teeheenottelling/nottellingyou.com
[6:41:53 AM] [semantic-release] › ✔ Allowed to push to the Git repository
[6:41:53 AM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/github"
[6:41:53 AM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication (https://api.github.com)
[6:41:53 AM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/github"
[6:41:53 AM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/changelog"
[6:41:53 AM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/changelog"
[6:41:53 AM] [semantic-release] › ℹ No git tag version found on branch main
[6:41:53 AM] [semantic-release] › ℹ No previous release found, retrieving all commits
[6:41:53 AM] [semantic-release] › ℹ Found 42 commits since last release
[6:41:53 AM] [semantic-release] › ℹ Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[6:41:53 AM] [semantic-release] › ✘ Failed step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[6:41:53 AM] [semantic-release] › ✘ An error occurred while running semantic-release: Error: Cannot find module 'conventional-changelog-conventionalcommits'
Error: Error: Cannot find module 'conventional-changelog-conventionalcommits'
at importFrom (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4.1.0/node_modules/import-from-esm/index.js:100:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async default (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4.1.0/node_modules/@semantic-release/commit-analyzer/lib/load-parser-config.js:25:63)
at async analyzeCommits (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4.1.0/node_modules/@semantic-release/commit-analyzer/index.js:31:18)
at async validator (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4.1.0/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
at async file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4.1.0/node_modules/semantic-release/lib/plugins/pipeline.js:38:36
at async file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4.1.0/node_modules/semantic-release/lib/plugins/pipeline.js:32:5
at async pluginsConfigAccumulator. [as analyzeCommits] (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4.1.0/node_modules/semantic-release/lib/plugins/index.js:87:11)
at async run (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4.1.0/node_modules/semantic-release/index.js:175:11)
at async Module.default (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4.1.0/node_modules/semantic-release/index.js:278:22) {
code: 'MODULE_NOT_FOUND',
pluginName: '@semantic-release/commit-analyzer'`

Expected behavior
Earlier in my pipeline I also add the below to make sure that its ready but it doesnt seem to be picked up by the action provided by yourself, it does complete inside of the previous step but maybe its the npm audit or something not sure.

        - name: Install conventional commits dependencies
          run: |
            yarn add -D conventional-changelog-conventionalcommits@6.1.0
            yarn add -D semantic-release-ms-teams@2.1.0
            yarn add -D aggregate-error@3.1.0
            YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install

Additional context
I was able to fix it by reducing the action version to

cycjimmy/semantic-release-action@v3.4.1

This is also a heads up to help people who might pop into this issue.

@ajfranzoia
Copy link

In my case I was able to fix it by downgrading the plugin version to conventional-changelog-conventionalcommits@v5.

@kddsultan
Copy link

This issue occurs with me too. And the suggestion by @ajfranzoia is working (Thanks for that). @cycjimmy Do you know what causes the issue?

@iuscare
Copy link

iuscare commented May 30, 2024

I encountered the same error. It occurred after the checkout action was deprecated in version 2 due to the end of support for Node 16. When I switched to action version 4, the error appeared. I can also confirm that the solution provided by @ajfranzoia resolved the issue for now

@rbardini
Copy link

rbardini commented Aug 3, 2024

Pinning the semantic-release version to 24 (latest at the time of this comment) worked for me:

      - name: Release
        uses: cycjimmy/semantic-release-action@v4
        with:
          semantic_version: 24
          extra_plugins: |
            conventional-changelog-conventionalcommits

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

5 participants