Error when running using Yarn PnP mode
wojtekmaj opened this issue · 1 comments
wojtekmaj commented
When running chalk@^5.2.0
in Yarn PnP environment (in my case, indirectly, by running yarn dlx serve
instead of npx serve
, the following error is thrown:
/private/var/folders/wg/cztxqmdj6h94ht8783cym75c0000gp/T/xfs-f5b08830/dlx-706/.pnp.cjs:9364
return Object.defineProperties(new Error(message), {
^
Error: chalk tried to access #ansi-styles, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: #ansi-styles (via "#ansi-styles/package.json")
Required by: chalk@npm:5.0.1 (via /Users/wmaj/.yarn/berry/cache/chalk-npm-5.0.1-6afcb94227-8.zip/node_modules/chalk/source/index.js)
at makeError (/private/var/folders/wg/cztxqmdj6h94ht8783cym75c0000gp/T/xfs-f5b08830/dlx-706/.pnp.cjs:9364:34)
at resolveToUnqualified (/private/var/folders/wg/cztxqmdj6h94ht8783cym75c0000gp/T/xfs-f5b08830/dlx-706/.pnp.cjs:10283:21)
at Object.resolveToUnqualified (/private/var/folders/wg/cztxqmdj6h94ht8783cym75c0000gp/T/xfs-f5b08830/dlx-706/.pnp.cjs:10427:26)
at resolve$1 (file:///private/var/folders/wg/cztxqmdj6h94ht8783cym75c0000gp/T/xfs-f5b08830/dlx-706/.pnp.loader.mjs:224:31)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
at link (node:internal/modules/esm/module_job:75:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.12.1
This is directly related to 04fdbd6 in which dependencies were bundled and imports
feature was leveraged.
Note: this was also raised as yarnpkg/berry#5187.
wojtekmaj commented
Turns out you need to update Corepack:
npm update -g corepack
Crashed on Corepack 0.14.2 for me, but runs smoothly on Corepack 0.15.3.