Trying my best to describe the issue,
yarn 1.22.19, node 16.16.0, MacOS
- start from an existing node app, everything was fine including unit tests
- yarn upgrade-interactive --latest (Note: i just picked a few for upgrade), i got the new package.json and new yarn.lock
- "yarn test" passes, this is for unit tests
- rm -rf node_modules
- yarn install
- "yarn test" fails (similar to this https://github.com/iarna/wide-align/issues/63)
- Error [ERR_REQUIRE_ESM]: require() of ES Module /myApp/node_modules/string-width/index.js from /myApp/node_modules/cliui/build/index.cjs not supported.
- revert back the yarn.lock, the only change now is package.json
- yarn install
- "yarn test" passes
so if i'm in a new system, start from the new package.json and the new yarn.lock, i cannot start my app. I need the old yarn.lock with the new package.json to do the proper install. Do understand the node_modules are different from these 2 cases, but how to fix this pls ?
Just as Phil suggested, upgrade to yarn v3 fixed the issue.