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

ERR_REQUIRED_ESM error with semantic-release/gitlab #136

Closed
karlomedallo opened this issue Feb 5, 2023 · 11 comments · Fixed by #143
Closed

ERR_REQUIRED_ESM error with semantic-release/gitlab #136

karlomedallo opened this issue Feb 5, 2023 · 11 comments · Fixed by #143
Labels

Comments

@karlomedallo
Copy link

karlomedallo commented Feb 5, 2023

Hi, I'm not sure if this error is from semantic-release-monorepo or from @semantic-release/gitlab

I have posted it here:

semantic-release/gitlab#493

and here's the error:

[12:10:32 PM] [semantic-release] › ✘  An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module /builds/repo/node_modules/.pnpm/@semantic-release+gitlab@10.1.4_semantic-release@20.1.0/node_modules/@semantic-release/gitlab/index.js from /builds/repo/node_modules/.pnpm/semantic-release-plugin-decorators@3.0.1_semantic-release@20.1.0/node_modules/semantic-release-plugin-decorators/src/wrapStep.js not supported.
Instead change the require of index.js in /builds/repo/node_modules/.pnpm/semantic-release-plugin-decorators@3.0.1_semantic-release@20.1.0/node_modules/semantic-release-plugin-decorators/src/wrapStep.js to a dynamic import() which is available in all CommonJS modules.
    at semantic-release-monorepo (/builds/repo/node_modules/.pnpm/semantic-release-plugin-decorators@3.0.1_semantic-release@20.1.0/node_modules/semantic-release-plugin-decorators/src/wrapStep.js:49:24)
    at validator (file:///builds/repo/node_modules/.pnpm/semantic-release@20.1.0/node_modules/semantic-release/lib/plugins/normalize.js:36:30)
    at file:///builds/repo/node_modules/.pnpm/semantic-release@20.1.0/node_modules/semantic-release/lib/plugins/pipeline.js:37:40
    at next (file:///builds/repo/node_modules/.pnpm/p-reduce@3.0.0/node_modules/p-reduce/index.js:16:10) {
  code: 'ERR_REQUIRE_ESM',
  pluginName: '[Function: semantic-release-monorepo]'
}
Error [ERR_REQUIRE_ESM]: require() of ES Module /builds/repo/node_modules/.pnpm/@semantic-release+gitlab@10.1.4_semantic-release@20.1.0/node_modules/@semantic-release/gitlab/index.js from /builds/repo/node_modules/.pnpm/semantic-release-plugin-decorators@3.0.1_semantic-release@20.1.0/node_modules/semantic-release-plugin-decorators/src/wrapStep.js not supported.
Instead change the require of index.js in /builds/repo/node_modules/.pnpm/semantic-release-plugin-decorators@3.0.1_semantic-release@20.1.0/node_modules/semantic-release-plugin-decorators/src/wrapStep.js to a dynamic import() which is available in all CommonJS modules.
    at semantic-release-monorepo (/builds/repo/node_modules/.pnpm/semantic-release-plugin-decorators@3.0.1_semantic-release@20.1.0/node_modules/semantic-release-plugin-decorators/src/wrapStep.js:49:24)
    at validator (file:///builds/repo/node_modules/.pnpm/semantic-release@20.1.0/node_modules/semantic-release/lib/plugins/normalize.js:36:30)
    at file:///builds/repo/node_modules/.pnpm/semantic-release@20.1.0/node_modules/semantic-release/lib/plugins/pipeline.js:37:40
    at next (file:///builds/repo/node_modules/.pnpm/p-reduce@3.0.0/node_modules/p-reduce/index.js:16:10) {
  code: 'ERR_REQUIRE_ESM',
  pluginName: '[Function: semantic-release-monorepo]'
}undefined
/builds/repo/src/libs/eslint-config:
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 1: node_modules/.bin/semantic-release
 ELIFECYCLE  Command failed with exit code 1.
@JonasSchubert
Copy link

@semantic-release/gitlab was recently changed to ESM only. As #135 describes this is most likely the cause for your error.
This package has to be migrated to ESM too, if you want to use v10 of @semantic-release/gitlab. Maybe try v9 and check whether it works with the previous version.

@villelahdenvuo
Copy link

villelahdenvuo commented Apr 21, 2023

Same is happening with other parts of semantic-release, I guess this plugin needs to be updated to ESM to continue working...

[11:24:22 AM] [semantic-release] › ✘  Failed step "analyzeCommits" of plugin "[Function: semantic-release-monorepo]"
[11:24:22 AM] [semantic-release] › ✘  An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/circleci/repo/node_modules/@semantic-release/npm/index.js from /home/circleci/repo/node_modules/semantic-release-plugin-decorators/src/wrapStep.js not supported.
Instead change the require of index.js in /home/circleci/repo/node_modules/semantic-release-plugin-decorators/src/wrapStep.js to a dynamic import() which is available in all CommonJS modules.
    at semantic-release-monorepo (/home/circleci/repo/node_modules/semantic-release-plugin-decorators/src/wrapStep.js:49:24)
    at validator (file:///home/circleci/repo/node_modules/semantic-release/lib/plugins/normalize.js:36:30)
    at file:///home/circleci/repo/node_modules/semantic-release/lib/plugins/pipeline.js:38:42
    at next (file:///home/circleci/repo/node_modules/p-reduce/index.js:16:10) {
  code: 'ERR_REQUIRE_ESM',
  pluginName: '[Function: semantic-release-monorepo]'
}

Edit: Looks like there's a PR #137

@JOU-amjs
Copy link

same problems.

[10:45:04 AM] [semantic-release] › ✘  An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/scene/scene/node_modules/@semantic-release/commit-analyzer/index.js from /home/runner/work/scene/scene/node_modules/semantic-release-plugin-decorators/src/wrapStep.js not supported.
Instead change the require of index.js in /home/runner/work/scene/scene/node_modules/semantic-release-plugin-decorators/src/wrapStep.js to a dynamic import() which is available in all CommonJS modules.
    at semantic-release-monorepo (/home/runner/work/scene/scene/node_modules/semantic-release-plugin-decorators/src/wrapStep.js:49:24)
    at validator (file:///home/runner/work/scene/scene/node_modules/semantic-release/lib/plugins/normalize.js:36:30)
    at file:///home/runner/work/scene/scene/node_modules/semantic-release/lib/plugins/pipeline.js:[38](https://github.com/alovajs/scene/actions/runs/5411307043/jobs/9833872625#step:5:39):[42](https://github.com/alovajs/scene/actions/runs/5411307043/jobs/9833872625#step:5:43)
    at next (file:///home/runner/work/scene/scene/node_modules/semantic-release/node_modules/p-reduce/index.js:16:10) {
  code: 'ERR_REQUIRE_ESM',
  pluginName: '[Function: semantic-release-monorepo]'
}
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/scene/scene/node_modules/@semantic-release/commit-analyzer/index.js from /home/runner/work/scene/scene/node_modules/semantic-release-plugin-decorators/src/wrapStep.js not supported.
Instead change the require of index.js in /home/runner/work/scene/scene/node_modules/semantic-release-plugin-decorators/src/wrapStep.js to a dynamic import() which is available in all CommonJS modules.
    at semantic-release-monorepo (/home/runner/work/scene/scene/node_modules/semantic-release-plugin-decorators/src/wrapStep.js:[49](https://github.com/alovajs/scene/actions/runs/5411307043/jobs/9833872625#step:5:50):24)
    at validator (file:///home/runner/work/scene/scene/node_modules/semantic-release/lib/plugins/normalize.js:36:30)
    at file:///home/runner/work/scene/scene/node_modules/semantic-release/lib/plugins/pipeline.js:38:42
    at next (file:///home/runner/work/scene/scene/node_modules/semantic-release/node_modules/p-reduce/index.js:16:10) {
  code: 'ERR_REQUIRE_ESM',
  pluginName: '[Function: semantic-release-monorepo]'
}npm ERR! Lifecycle script `release` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @alova/scene-vue@1.1.0 
npm ERR!   at location: /home/runner/work/scene/scene/packages/scene-vue 
Error: Process completed with exit code 1.

@jcapogna
Copy link

jcapogna commented Jul 4, 2023

Related issue in the @semantic-release/gitlab project: semantic-release/gitlab#493

The solution appears to be downgrade to @semantic-release/gitlab v9 until semantic-release-monorepo is updated to support ESM. This worked for me.

@jcapogna
Copy link

jcapogna commented Jul 4, 2023

@semantic-release/commit-analyzer and @semantic-release/npm also recently moved to ESM. You need to downgrade those to v9 too.

I created #138 to document which plugins need to be downgraded due to lack of ESM support in semantic-release-monorepo.

@bryanjtc
Copy link
Contributor

bryanjtc commented Nov 1, 2023

I published a new package semantic-release-monorepo-esm that supports esm. v1.0.10 should work without issues.
The new package is based on the changes in this pr. #143

@karlo-humanmanaged
Copy link

@bryanjtc : Just wondering why don't you just start a new repo completely based on what you have done? I think it is awesome that you get to work on this. I really find that this repo is not really maintained. I'm actually looking at other solutions and migrating our codebase away from this

@bryanjtc
Copy link
Contributor

bryanjtc commented Nov 21, 2023

@bryanjtc : Just wondering why don't you just start a new repo completely based on what you have done? I think it is awesome that you get to work on this. I really find that this repo is not really maintained. I'm actually looking at other solutions and migrating our codebase away from this

I have been thinking to do that for a while now. The plan is to keep updating semantic-release-esm to just support new semantic-release versions. Easier to maintain that way. I also want to create new packages one as a config and another as a plugin for monorepos using semantic-release. These new packages can have new, maybe breaking features, such as support for dotnet and other feature requests from this repo.

@mario-jerkovic
Copy link

@karlo-humanmanaged @jcapogna
We've released a monorepo package that's compatible with ESM, and since you have access to the source code, you're free to customize it as you wish. Cheers! 🍻

NPM package: https://www.npmjs.com/package/@rimac-technology/semantic-release-monorepo
Source code: https://github.com/RimacTechnology/semantic-release-monorepo

Copy link

🎉 This issue has been resolved in version 8.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kpturner
Copy link

🎉 This issue has been resolved in version 8.0.0 🎉

Which issue?

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

Successfully merging a pull request may close this issue.

9 participants