nest-modules / mailer

📨 A mailer module for Nest framework (node.js)
https://nest-modules.github.io/mailer/
MIT License
846 stars 177 forks source link

Upgrading breaks the installation somehow with error "[ERR_REQUIRE_ESM]" #1017

Closed mehdibo closed 10 months ago

mehdibo commented 1 year ago

Describe the bug I am using Yarn.

When I try to upgrade from 1.8.1 to 1.9.1, yarn fails with the following error:

| Error [ERR_REQUIRE_ESM]: require() of ES Module *****/node_modules/string-width/index.js from /*****/node_modules/wide-align/align.js not supported.
| Instead change the require of index.js in *****/node_modules/wide-align/align.js to a dynamic import() which is available in all CommonJS modules.
|     at Object.<anonymous> (*****/node_modules/wide-align/align.js:2:19)
|     at Object.<anonymous> (*****/node_modules/gauge/render-template.js:2:13)
|     at Object.<anonymous> (*****/node_modules/gauge/plumbing.js:3:22)
|     at Object.<anonymous> (*****/node_modules/gauge/index.js:2:16)
|     at Object.<anonymous> (*****/node_modules/npmlog/log.js:3:13)
|     at Object.<anonymous> (*****/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js:23:13)
|     at Object.<anonymous> (*****/node_modules/@mapbox/node-pre-gyp/lib/main.js:9:22)
|     at Object.<anonymous> (*****/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp:4:1) {
|   code: 'ERR_REQUIRE_ESM'

Package versions:

  name                    range   from      to     url
❯◯ @nestjs-modules/mailer  ^1.8.1  1.8.1  ❯  1.9.1  https://github.com/nest-modules/mailer#readme
 ◯ handlebars              ^4.7.7  4.7.7  ❯  4.7.8  https://www.handlebarsjs.com/
 ◯ nodemailer              ^6.9.1  6.9.3  ❯  6.9.4  https://nodemailer.com/

 devDependencies
   name                    range   from      to     url
 ◯ @types/nodemailer       ^6.4.7  6.4.8  ❯  6.4.9  https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodemailer

Node version: v20.5.0

Yarn version: 1.22.19

ghost commented 1 year ago

I found this solution.

https://github.com/nestjs/nest/issues/11660#issuecomment-1562090495

You can add this code into package.json

"resolutions": {
    "wrap-ansi": "7.0.0",
    "string-width": "4.1.0"
}
ObicaFF commented 1 year ago

At the moment, this is an actual problem. The above solution helps, but leaves behind a bunch of warnings:

warning Resolution field "string-width@4.1.0" is incompatible with requested version "string-width@^5.1.2"
warning Resolution field "wrap-ansi@7.0.0" is incompatible with requested version "wrap-ansi@^8.1.0"
warning Resolution field "string-width@4.1.0" is incompatible with requested version "string-width@^4.2.0"
warning Resolution field "string-width@4.1.0" is incompatible with requested version "string-width@^4.2.0"
warning Resolution field "string-width@4.1.0" is incompatible with requested version "string-width@^4.2.0"
warning Resolution field "string-width@4.1.0" is incompatible with requested version "string-width@^4.2.3"
warning Resolution field "string-width@4.1.0" is incompatible with requested version "string-width@^4.2.0"
ColiZei commented 1 year ago

Same here ...

ColiZei commented 1 year ago

Any news here?