ERR_REQUIRE_ESM when upgrading from 0.13.6 to 0.13.8
RobinTail opened this issue · comments
Getting this error when trying to upgrade @arethetypeswrong/cli
to the latest version.
$ attw --pack
.../node_modules/cli-table3/src/utils.js:1
const stringWidth = require('string-width');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/string-width/index.js from .../node_modules/cli-table3/src/utils.js not supported.
Instead change the require of index.js in .../node_modules/cli-table3/src/utils.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (.../node_modules/cli-table3/src/utils.js:1:21) {
code: 'ERR_REQUIRE_ESM'
}
Node.js v20.11.0
Also noticed these warning during yarn install
warning Pattern ["string-width-cjs@npm:string-width@^4.2.0"] is trying to unpack in the same destination ".../Library/Caches/Yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["string-width@^4.1.0"] is trying to unpack in the same destination ".../Library/Caches/Yarn/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
It seems there was a conflict on that package with another tool I'm using — tsup
=> Found "string-width-cjs@4.2.3"
info Reasons this module exists
- "@arethetypeswrong#cli#cli-table3" depends on it
- Hoisted from "@arethetypeswrong#cli#cli-table3#string-width-cjs"
- Hoisted from "tsup#sucrase#glob#jackspeak#@isaacs#cliui#string-width-cjs"
- Hoisted from "tsup#sucrase#glob#jackspeak#@isaacs#cliui#wrap-ansi-cjs#string-width-cjs"
=> Found "string-width@5.1.2"
info Reasons this module exists
- "tsup#sucrase#glob#jackspeak#@isaacs#cliui" depends on it
- Hoisted from "tsup#sucrase#glob#jackspeak#@isaacs#cliui#string-width"
- Hoisted from "tsup#sucrase#glob#jackspeak#@isaacs#cliui#wrap-ansi#string-width"
I managed to fix it by running yarn upgrade
.
Not an issue of the package