-
Notifications
You must be signed in to change notification settings - Fork 515
Closed
Description
Description
Yarn 1 seemingly breaks when packages rename their dependencies.
Via rimraf, we depend on @isaacs/cliui. This package depends on two versions of string-width simultaneously, see its package.json:
"string-width": "^5.1.2",
"string-width-cjs": "npm:string-width@^4.2.0",
string-width 5 is ESM-only, so version 4 is renamed to string-width-cjs. Yarn 1 seems to only support this properly when no yarn.lock is present. On every install attempt after the lockfile is created, Yarn 1 incorrectly hoists the more recent (ESM-only) version to the root of node_modules, which breaks imports from Common JS modules.
Yarn also complains about packages wanting to write to the same directory.
Other people experiencing this issue:
- Dependency on @isaacs/[email protected] is broken isaacs/jackspeak#5 (comment)
- fix: handle strings the same in cjs, esm, and deno yargs/cliui#139 (comment)
Steps to reproduce
- Checkout fix(deps): update dependency rimraf to v5.0.1 (master) - autoclosed #4069
- Remove
node_modulesandyarn.lock - Run
yarn installand observe success - Remove
node_modulesagain - Run
yarn installand observe brokenness
Expected behavior
Install succeeds.
Logs
No response
Config
No response
Your Setup
- Host OS: Fedora 38
- NodeJS version: v16.20.0, Yarn 1.22.19
Metadata
Metadata
Assignees
Labels
No labels