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

Error [ERR_REQUIRE_ESM]: require() of ES Module #221

Closed
xmnlab opened this issue Jul 6, 2023 · 10 comments
Closed

Error [ERR_REQUIRE_ESM]: require() of ES Module #221

xmnlab opened this issue Jul 6, 2023 · 10 comments

Comments

@xmnlab
Copy link

xmnlab commented Jul 6, 2023

Hi everyone!

running semantic-release in dry-run mode is raising the following error:

[11:29:37 PM] [semantic-release] › ℹ  Running semantic-release version 21.0.7
[11:29:37 PM] [semantic-release] › ✘  An error occurred while running semantic-release: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/xmn/.npm/_npx/1bba8fa66517c824/node_modules/lodash-es/lodash.js from /home/xmn/.npm/_npx/1bba8fa66517c824/node_modules/semantic-release-replace-plugin/dist/index.js not supported.
Instead change the require of lodash.js in /home/xmn/.npm/_npx/1bba8fa66517c824/node_modules/semantic-release-replace-plugin/dist/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/xmn/.npm/_npx/1bba8fa66517c824/node_modules/semantic-release-replace-plugin/dist/index.js:70:19) {
  code: 'ERR_REQUIRE_ESM'
}
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/xmn/.npm/_npx/1bba8fa66517c824/node_modules/lodash-es/lodash.js from /home/xmn/.npm/_npx/1bba8fa66517c824/node_modules/semantic-release-replace-plugin/dist/index.js not supported.
Instead change the require of lodash.js in /home/xmn/.npm/_npx/1bba8fa66517c824/node_modules/semantic-release-replace-plugin/dist/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/xmn/.npm/_npx/1bba8fa66517c824/node_modules/semantic-release-replace-plugin/dist/index.js:70:19) {
  code: 'ERR_REQUIRE_ESM'
} 

I am not super familiar with nodejs ... any idea about what is happening?
thanks!

@GruenSein
Copy link

I have the same issue ever since v1.2.x releases. At first, I thought it was my configuration since the plugin had been renamed but even after fixing all these issues the problem persists rendering my previously working release workflow completely unusable. Any help would be appreciated.

@KennyLindahl
Copy link

KennyLindahl commented Jul 6, 2023

It should be possible to downgrade to @google/semantic-release-replace-plugin@1.2.0, and it should work.

I also encountered this issue and compared it with the last successful deploy and it was 1.2.0 is when it worked, the latest version right now (1.2.1) is causing the issue described in the OP.


I think there is a fix for this on the way here: #222
@jpoehnelt When can we expect this to be merged and published to NPM?
By the way, please make sure to release it as a minor version (1.2.2) so it will automatically be resolved for most people.

Thanks

@jpoehnelt
Copy link
Owner

jpoehnelt commented Jul 6, 2023

Please try semantic-release-replace-plugin@1.2.4 or @google/semantic-release-replace-plugin@1.2.5

@rv-gbell
Copy link

rv-gbell commented Jul 18, 2023

@jpoehnelt I am not seeing OP's issue resolved as of the latest (1.2.6) release.
I am still seeing the same error as OP.

Am I missing something?

@DanielMcAssey
Copy link

DanielMcAssey commented Jul 19, 2023

Same here, same issue with 1.2.5

@jpoehnelt jpoehnelt reopened this Jul 20, 2023
@jpoehnelt
Copy link
Owner

Please try https://www.npmjs.com/package/semantic-release-replace-plugin/v/1.2.7 which includes changes from 90c2976.

@KennyLindahl
Copy link

KennyLindahl commented Jul 20, 2023

@jpoehnelt Thanks.


Just to highlight, this version requires:

  • Node 18 or above
  • Peer dependency to semantic-release version 20.1.0 or above

If anyone want to resolve the issue and not want to change the dependencies, then i suggest to install the earlier working version (1.2.0):

  • Put this in your package.json: @google/semantic-release-replace-plugin@1.2.0

@jpoehnelt jpoehnelt pinned this issue Jul 20, 2023
@jpoehnelt
Copy link
Owner

Just to highlight, this version requires:

  • Node 18 or above
  • Peer dependency to semantic-release version 20.1.0 or above

@KennyLindahl Please note that these are the same settings used by many of the most popular semantic release plugins at this time.

See semantic-release/semantic-release#2133
Screenshot 2023-07-20 at 10 57 15 AM

@jpoehnelt
Copy link
Owner

Closing this as there have been no reports. Please comment if you have an issue with >1.2.7. Sorry for the maintenance burden, the CJS/ESM churn is not fun 🤮 .

@xmnlab
Copy link
Author

xmnlab commented Jul 21, 2023

thanks for all the work on this lib @jpoehnelt !
it is a great tool!

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

6 participants