You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use the COREPACK_HOME to install the yarn package manager to a local folder inside my repo so I can commit the package manager in an air-gapped environment. Then next time I no longer need to download the package manager with that specific version from internet.
I noticed the once I set COREPACK_HOME to . and if my package.json under that same directory contains "type": "module", the yarn will throw error.
Run the yarn command and the following error shows up
Error: Dynamic require of "util" is not supported
at file:///home/node/v1/yarn/4.9.1/yarn.js:4:394
at file:///home/node/v1/yarn/4.9.1/yarn.js:4:3568
at file:///home/node/v1/yarn/4.9.1/yarn.js:4:474
at file:///home/node/v1/yarn/4.9.1/yarn.js:9:46383
at file:///home/node/v1/yarn/4.9.1/yarn.js:4:474
at file:///home/node/v1/yarn/4.9.1/yarn.js:413:15664
at file:///home/node/v1/yarn/4.9.1/yarn.js:759:448
at ModuleJob.run (node:internal/modules/esm/module_job:274:25)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:98:5)
Solution: If dynamic require is not supported, it should at least try a dynamic import as a fallback solution.
Environment
Note: I cannot run yarn from my if I installed the yarn to a local directory inside my repo.
System:
OS: Linux 6.4 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
CPU: (8) arm64 unknown
Binaries:
Node: 23.11.0 - /tmp/xfs-8ee5826b/node
Yarn: 4.9.1 - /tmp/xfs-8ee5826b/yarn
npm: 10.9.2 - /usr/local/bin/npm
Additional context
No response
The text was updated successfully, but these errors were encountered:
Self-service
Describe the bug
I tried to use the COREPACK_HOME to install the yarn package manager to a local folder inside my repo so I can commit the package manager in an air-gapped environment. Then next time I no longer need to download the package manager with that specific version from internet.
I noticed the once I set COREPACK_HOME to . and if my package.json under that same directory contains "type": "module", the yarn will throw error.
To reproduce
Create a following package.json
Then in the same folder run the following command
Run the yarn command and the following error shows up
Error: Dynamic require of "util" is not supported
at file:///home/node/v1/yarn/4.9.1/yarn.js:4:394
at file:///home/node/v1/yarn/4.9.1/yarn.js:4:3568
at file:///home/node/v1/yarn/4.9.1/yarn.js:4:474
at file:///home/node/v1/yarn/4.9.1/yarn.js:9:46383
at file:///home/node/v1/yarn/4.9.1/yarn.js:4:474
at file:///home/node/v1/yarn/4.9.1/yarn.js:413:15664
at file:///home/node/v1/yarn/4.9.1/yarn.js:759:448
at ModuleJob.run (node:internal/modules/esm/module_job:274:25)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:98:5)
Solution: If dynamic require is not supported, it should at least try a dynamic import as a fallback solution.
Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: