Closed georeith closed 1 year ago
So to clarify: you were able to reproduce this issue by just using Yarn v3, without changing any code in the init template?
First I want to say that the Yarn setup is not recommended: you should install v3 locally in .yarn/releases
—the global yarn
should always be the v1 one. Apart from that, I can reproduce the error, but I can't tell if it's a Yarn3 + pnpm nodeLinker issue, or really a Docusaurus issue. There doesn't seem to be anything obviously wrong from our side. Some observations:
yarn start
instantly freezes. There's no way to terminate the process until it crashes.pnpm
directly, or any other nodeLinker
(node-modules
or pnp
).First I want to say that the Yarn setup is not recommended: you should install v3 locally in
.yarn/releases
—the globalyarn
should always be the v1 one.
I check in a yarn release or use corepack normally, but what's the reasoning behind not using yarn 3 as your default?
yarn start
instantly freezes. There's no way to terminate the process until it crashes.
This was my experience too except it freezes after webpack compilation completes (you can still cancel during)
Update:
I found this issue: https://github.com/yarnpkg/berry/issues/4525
I tested docusaurus with webpack cache disabled via a plugin like so:
const disableWebpackCachePlugin = () => ({
name: 'disableWebpackCache',
configureWebpack() {
return { cache: false };
}
})
And it works.
So the issue appears to be with webpack cache and yarn 3's pnpm linker.
It appears a potential fix for this has been merged into Yarn: https://github.com/yarnpkg/berry/pull/4542 but not yet released under an official version.
Can confirm that using yarn set version canary
which installed 4.0.0-rc.37
is working correctly.
Great, glad you found the reason :)
For anyone else who has this problem and finds this issue, you may find yourself stuck between a rock and a hard place because even though Yarn 4 RC has a fix for this issue, if you use turbo
or esbuild
those will fail to install with the RC as of now: https://github.com/yarnpkg/berry/issues/5165.
Instead I found a workaround (it's not elegant I know) using the following postinstall
script (replace site/
with your docusaurus folder in a monorepo or remove it in a standard repo):
{
"postinstall": "rm -rf site/node_modules/@docusaurus/core/node_modules/terser-webpack-plugin/node_modules/webpack"
}
This removes the circular symlink that gets created each time yarn install
runs which caused the initial issue.
To make matters worse, yarn
doesn't run postinstall
after every install so you may need to use something like: https://github.com/mhassan1/yarn-plugin-after-install to make it work all the time.
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
yarn start
inside of a docusaurus project installed with yarn 3 using the pnpm linkage mode triggers the following error:I have also seen this other issue but they were unable to make a reproduction: https://github.com/facebook/docusaurus/issues/8421
Reproducible demo
https://github.com/georeith/docusuraus-issue-fatal-size
I created this reproduction by:
yarn 3
and configuring itslinkageMode
topnpm
npx create-docusaurus@latest site classic --typescript -p yarn
(reproducible without TypeScript too)
Steps to reproduce
yarn
yarn start
https://user-images.githubusercontent.com/3090066/215575595-750e953c-df2e-4d17-ad0d-85ab1b0d60a8.mp4
Expected behavior
The site should not crash
Actual behavior
The site crashes
Your environment
Self-service