semantic-release-action icon indicating copy to clipboard operation
semantic-release-action copied to clipboard

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

Open Decklyn-Mac opened this issue 10 months ago • 4 comments

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/[email protected]
          id: semantic   # Need an `id` for output variables
          with:
            branch: main
            extra_plugins: |
              [email protected]
              [email protected]
              [email protected]
          env:
            GH_TOKEN: ${{ secrets.gh_access_token }}
            NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
            

Here is the error

`Run cycjimmy/[email protected]

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 [email protected]
            yarn add -D [email protected]
            yarn add -D [email protected]
            YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
            

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

cycjimmy/[email protected]

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

Decklyn-Mac avatar Apr 04 '24 07:04 Decklyn-Mac

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

ajfranzoia avatar May 07 '24 18:05 ajfranzoia

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

kddsultan avatar May 23 '24 15:05 kddsultan

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

iuscare avatar May 30 '24 00:05 iuscare

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

rbardini avatar Aug 03 '24 23:08 rbardini