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

Cannot find module 'semantic-release-replace-plugin' #223

Closed
TheSlimvReal opened this issue Jul 7, 2023 · 11 comments
Closed

Cannot find module 'semantic-release-replace-plugin' #223

TheSlimvReal opened this issue Jul 7, 2023 · 11 comments

Comments

@TheSlimvReal
Copy link

Since version 1.2.1 and later I get the following error in my GitHub workflow that runs semantic release:

[5:08:25 AM] [semantic-release] › ℹ  Running semantic-release version 19.0.5
[5:08:25 AM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Cannot find module 'semantic-release-replace-plugin'
Require stack:
- /home/runner/work/ndb-core/ndb-core/noop.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at resolveFileName (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/resolve-from/index.js:29:39)
    at resolveFrom (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/resolve-from/index.js:43:9)
    at module.exports (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/resolve-from/index.js:46:47)
    at loadPlugin (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/utils.js:51:82)
    at /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/index.js:17:37
    at Array.reduce (<anonymous>)
    at module.exports (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/index.js:[14](https://github.com/Aam-Digital/ndb-core/actions/runs/5482968601/jobs/9988838364#step:4:15):34)
    at module.exports (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/get-config.js:84:35)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/runner/work/ndb-core/ndb-core/noop.js' ]
}

I had to downgrade to @google/semantic-release-replace-plugin@1.2.0to make it work again.
Maybe this error has something to do with Node 14 which I have to use in order to fix this issue

My (failing) workflow:

  run-semantic-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          persist-credentials: false
      # Only required temporary: https://github.com/cycjimmy/semantic-release-action/issues/159
      - uses: actions/setup-node@v3
        with:
          node-version: 14
      - name: Semantic Release
        uses: cycjimmy/semantic-release-action@v3
        env:
          GITHUB_TOKEN: ***
          SLACK_WEBHOOK: ***
        with:
          extra_plugins: |
            semantic-release-replace-plugin
            @semantic-release/git
            @semantic-release/github
            semantic-release-slack-bot
@bigbrozer
Copy link

Same issue here using this plugin with 1.2.4 and Node 18.16.1.
Note: this is working properly when using the new version of @google/semantic-release-replace-plugin@1.2.5.

@BitFis
Copy link

BitFis commented Jul 7, 2023

Same issue here with semantic-release-replace-plugin@1.2.4 and Node v19.1.0

@bearkfear
Copy link

Same issue here!

@xmnlab
Copy link

xmnlab commented Jul 11, 2023

+1

@karma-git
Copy link

I'm also looking for fix, thank you

@jpoehnelt
Copy link
Owner

Is everyone using the plugin with the GitHub action, cycjimmy/semantic-release-action?

@karma-git
Copy link

karma-git commented Jul 11, 2023

no, I'm building my own pipeline in github-ci, but as guys mention above it does not work.
When I enable your module via .realease.json - semantic-cli crashes exactly like the issue author mention

@jpoehnelt
Copy link
Owner

jpoehnelt commented Jul 11, 2023

should be fixed with bef4c0a. I knew it had to be something super silly!

@jpoehnelt
Copy link
Owner

Please test with version >= 1.2.6, https://www.npmjs.com/package/semantic-release-replace-plugin/v/1.2.6.

@TheSlimvReal
Copy link
Author

With the latest version I am getting a new error

[9:28:45 AM] [semantic-release] › ℹ  Running semantic-release version 19.0.5
[9:28:46 AM] [semantic-release] › ✖  An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release-replace-plugin/dist/index.js from /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/utils.js not supported.
Error: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release-replace-plugin/dist/index.js from /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/utils.js not supported.
Instead change the require of index.js in /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/utils.js to a dynamic import() which is available in all CommonJS modules.
Instead change the require of index.js in /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/utils.js to a dynamic import() which is available in all CommonJS modules.
    at loadPlugin (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/utils.js:51:36)
    at /home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/index.js:17:37
    at Array.reduce (<anonymous>)
    at module.exports (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/plugins/index.js:[14](https://github.com/Aam-Digital/ndb-core/actions/runs/5573981595/jobs/10181993405#step:4:15):34)
    at module.exports (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/lib/get-config.js:84:35)
    at async module.exports (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/node_modules/semantic-release/index.js:265:32)
    at async release (/home/runner/work/_actions/cycjimmy/semantic-release-action/v3/src/index.js:30:[18](https://github.com/Aam-Digital/ndb-core/actions/runs/5573981595/jobs/10181993405#step:4:19)) {
  code: 'ERR_REQUIRE_ESM'

This might be because I am using Node version 14 as mentioned above.

@karma-git
Copy link

Hello everyone!

I've returned to this plugin for bump python version via CI/CD but still couldn't make it :(
Sheck the error and my settings under the spoiler

@jpoehnelt , could you take a look, please?

spoiler

Error

bash-5.1# semantic-release
[2:09:07 AM] [semantic-release] › ℹ  Running semantic-release version 19.0.5
[2:09:08 AM] [semantic-release] › ✖  An error occurred while running semantic-release: Error: Cannot find module 'semantic-release-replace-plugin'
Require stack:
- /builds/infrastructure/playground/a.horbach/sermver-playground/noop.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
    at resolveFileName (/usr/local/lib/node_modules/semantic-release/node_modules/resolve-from/index.js:29:39)
    at resolveFrom (/usr/local/lib/node_modules/semantic-release/node_modules/resolve-from/index.js:43:9)
    at module.exports (/usr/local/lib/node_modules/semantic-release/node_modules/resolve-from/index.js:46:47)
    at loadPlugin (/usr/local/lib/node_modules/semantic-release/lib/plugins/utils.js:51:82)
    at /usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:17:37
    at Array.reduce (<anonymous>)
    at module.exports (/usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:14:34)
    at module.exports (/usr/local/lib/node_modules/semantic-release/lib/get-config.js:84:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/builds/infrastructure/playground/a.horbach/sermver-playground/noop.js'
  ]
}
Error: Cannot find module 'semantic-release-replace-plugin'
Require stack:
- /builds/infrastructure/playground/a.horbach/sermver-playground/noop.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
    at resolveFileName (/usr/local/lib/node_modules/semantic-release/node_modules/resolve-from/index.js:29:39)
    at resolveFrom (/usr/local/lib/node_modules/semantic-release/node_modules/resolve-from/index.js:43:9)
    at module.exports (/usr/local/lib/node_modules/semantic-release/node_modules/resolve-from/index.js:46:47)
    at loadPlugin (/usr/local/lib/node_modules/semantic-release/lib/plugins/utils.js:51:82)
    at /usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:17:37
    at Array.reduce (<anonymous>)
    at module.exports (/usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:14:34)
    at module.exports (/usr/local/lib/node_modules/semantic-release/lib/get-config.js:84:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/builds/infrastructure/playground/a.horbach/sermver-playground/noop.js'
  ]

package:

bash-5.1# npm list -g
/usr/local/lib
+-- @google/semantic-release-replace-plugin@1.2.7
+-- @semantic-release/changelog@6.0.1
+-- @semantic-release/commit-analyzer@9.0.2
+-- @semantic-release/exec@6.0.3
+-- @semantic-release/git@10.0.0
+-- @semantic-release/gitlab@9.3.0
+-- @semantic-release/release-notes-generator@10.0.3
+-- conventional-changelog-conventionalcommits@5.0.0
+-- conventional-changelog-eslint@3.0.9
+-- corepack@0.10.0
+-- npm@8.8.0
+-- semantic-release-conventional-commits@3.0.0
`-- semantic-release@19.0.5

My cfg:

{
  "branches": ["master", "feature/typer"],
  "tagFormat": "${version}",
  "plugins": [
    "@semantic-release/gitlab",
    [
      "@semantic-release/commit-analyzer",
      {
        "preset": "conventionalcommits",
        "releaseRules": [
          {"type": "breaking", "release": "major"},
          {"type": "feat", "release": "minor"},
          {"type": "docs", "release": false},
          {"type": "fix", "release": "patch"},
          {"type": "style", "release": false},
          {"type": "refactor", "release": false},
          {"type": "chore", "release": "patch"}
        ]
      }
    ],
    [
      "@semantic-release/release-notes-generator",
      {
        "preset": "conventionalcommits",
        "presetConfig": {
          "types": [
            {"type": "breaking", "section": "Breaking Change"},
            {"type": "feat", "section": "Feature"},
            {"type": "docs", "section": "Documentation"},
            {"type": "fix", "section": "Fix"},
            {"type": "style", "section": "Style"},
            {"type": "refactor", "section": "Refactoring"},
            {"type": "chore", "section": "Chore"}
          ]
        }
      }
    ],
    [
      "@semantic-release/changelog",
      {
        "changelogFile": "CHANGELOG.md"
      }
    ],
    [
      "@semantic-release/git",
      {
        "assets": [
          "CHANGELOG.md"
        ],
        "message": "release: ${lastRelease.version} -> ${nextRelease.version}\n\n${nextRelease.notes}"
      }
    ],
    [
      "semantic-release-replace-plugin",
      {
        "replacements": [
          {
            "files": ["foo/__init__.py"],
            "from": "__VERSION__ = \".*\"",
            "to": "__VERSION__ = \"${nextRelease.version}\"",
            "results": [
              {
                "file": "foo/__init__.py",
                "hasChanged": true,
                "numMatches": 1,
                "numReplacements": 1
              }
            ],
            "countMatches": true
          }
        ]
      }
    ]
  ]
}

Dockerfile:

FROM alpine:3.18.2

RUN apk add --no-cache \
    git~=2.40\
    python3~=3.11.4 \
    py3-pip~=23.1.2 \
  && apk add --no-cache --virtual .build-deps \
    py3-cryptography~=40.0.2 \
  && pip install --no-cache-dir \
    black==23.3.0 \
    flake8==6.0.0 \
    bumpversion==0.6.0 \
    mkdocs-material==9.1.18 \
    mkdocs-mermaid2-plugin==0.6.0 \
    mkdocs-awesome-pages-plugin==2.9.1 \
    poetry==1.5.1 \
    pygments==2.15.1 \
    pylint==2.17.4 \
    twine==4.0.2 \
    wheel==0.40.0 \
  && apk del .build-deps

RUN addgroup --gid 10001 app \
  && adduser \
    --uid 10001 \
    --home /home/app \
    --shell /bin/ash \
    --ingroup app \
    --disabled-password \
    app

USER 10001

WORKDIR /home/app

ENTRYPOINT [ "" ]

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

7 participants