Next.js cannot run in Yarn v2 PnP mode with "enableGlobalCache" enabled
See original GitHub issueBug report
Describe the bug
Next.js cannot run in Yarn v2 PnP mode with “enableGlobalCache” enabled.
To Reproduce
Execute following shell script.
mkdir pages
cat <<'EOF' > pages/index.js
export default function Index() {
return <h1>Hi</h1>
}
EOF
cat <<'EOF' > package.json
{
"dependencies": {
"next": "9.5.1",
"react": "16.13.1",
"react-dom": "16.13.1"
}
}
EOF
yarn set version berry
yarn config set enableGlobalCache true
yarn install
yarn next dev
Expected behavior
Next.js server should be started.
Screenshots
error - ./.yarn/$$virtual/next-virtual-061300f485/3/.yarn/berry/cache/next-npm-9.4.5-canary.39-f06383efbf-5.zip/node_modules/next/dist/client/dev/amp-dev.js
Error: [BABEL] /home/simnalamburt/workspace/a/.yarn/$$virtual/next-virtual-061300f485/3/.yarn/berry/cache/next-npm-9.4.5-canary.39-f06383efbf-5.zip/node_modules/next/dist/client/dev/amp-dev.js: Failed to resolve "@babel/runtime" relative to "/home/simnalamburt/workspace/a/.yarn/$$virtual/next-virtual-061300f485/3/.yarn/berry/cache/next-npm-9.4.5-canary.39-f06383efbf-5.zip/node_modules/next/dist/build/babel" (While processing: "programmatic item$6")
at Array.reduce (<anonymous>)
System information
- OS: Debian GNU/Linux 10
- Version of Next.js: Reproducible in
9.4.4
,9.4.5-canary.31
,9.4.5-canary.39
,9.5.1
- Version of Node.js: v14.5.0
Additional context
It seems to be a problem with some of the dependencies used by Next.js. I want to know which dependencies cause problems.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Next.js 13: Build failure when enabling appDir and using Yarn ...
When using Yarn PnP to manage packages, running next bulid with appDir enabled will fail to build. The build log is:.
Read more >Next.js with Yarn pnp in a mono repo keep failing when trying ...
It seems like the main problem here is the build tool, because when I run the Next.js server itself ( yarn dev )...
Read more >Advanced package manager features for npm, Yarn, and pnpm
PnP is the default mode of Yarn Berry, but you can also explicitly enable it within .yarnrc.yml . # .yarnrc.yml # alternatively, remove...
Read more >Yarn Zero-Installs & Plug'n'Play – PAKDB - Jesidea
In this install mode (the default starting from Yarn 2.0), Yarn generates a single .pnp.cjs file instead of the usual node_modules folder containing...
Read more >esbuild-linux-s390x - NPM Package Versions - Socket.dev
The Linux IBM Z 64-bit Big Endian binary for esbuild, a JavaScript bundler. Version: 0.15.10 was published by evanw.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@simnalamburt No problem! But I think this is more related to the
resolve
package. For some reason, the PnP Api is not getting injected…@arcanis, do you know what the issue is? Thanks!
I also encountered the same issue in version
9.5.1
. Managed to workaround it by applying the following patch to@babel/plugin-transform-runtime
.And adding this to
package.json
: