-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non declared dependencies throwing errors in Yarn v2 (berry) #2576
Comments
This is a little tricky. Docusaurus v2 runs on a plugin system, so |
Me too, I try out everything but it's still hopeless. Even I try to change |
I'm running into a sim issue with |
I made an example to show how you can use some hacks to make docusaurus v2 work with pnp: https://github.com/SamChou19815/docusaurus-yarn-v2-example |
The latest release would fix most of the problems. However, you still need |
It's possible to use yarn without enabling loose mode if you add the Webpack PNP plugin and patch a few of the missing dependencies. The PNP plugin won't be required with webpack5 https://github.com/jgeschwendt/repro-docusaurus-yarn2/commits/patch |
@jgeschwendt PNP plugin is already added: #2796 |
Awesome, didn't know that, I pushed up a new commit removing the plugin. Is there something wrong with resolving those missing dependencies in the
|
I just tried to use Docusaurus for one of my projects so I investigated a bit. I think there are two things at play. The first is the following error:
This is because To fix that, simply process const resolvedModuleImport = createRequire(path.join(context.siteDir, 'package.json')).resolve(presetModuleImport);
const presetModule: any = importFresh(resolvedModuleImport); This will ensure that the preset is resolved against the dependencies declared by the site directory, which is likely what you intend to do. Note that this doesn't use any non-standard API - A second problem (but really, not that much of a problem if it works for you) is that |
Thanks @arcanis, not very familiar with these problems but trying to figure this out 😅
Due to issues in the past, we actually have a runtime check to ensure all versions are the same, as using different versions often lead to unexpected failures. You should get an error like: |
We are going to release very soon, let me know tomorrow afternoon if you still have issues with latest version, or if we can close this issue |
@arcanis fix released in 2.0.0-alpha.69 |
closing, assuming it's fixed, but let me know if it's not |
@slorber this is an old issue but I just came across it.
|
Agree @arrowplum , going to re-open We now have CI tests for Yarn 1 + Yarn 3 (node+pnp linkers) in lose mode but the non-lose mode doesn't work due to some deps graph issues (also due to a regression I introduced in a recent change). Last time I investigated we had some kind of cyclic dependency that will likely need to create a new Docusaurus package |
I was having some issues with this in my testing of migrating to Yarn v3. It's been a little tricky, and I ran out of time to debug the issues. If I get some more time, I'll report back with any thoughts on it. If you have a second to dig into this, it would be much appreciated! Thank you 🙏 |
🐛 Bug Report
Attempting to use Docusaurus v2 with Yarn v2 (berry).
As soon as i run
yarn build
the build explodes with dependency errors from yarn v2.Lots of peer dependencies aren't specified and yarn v2 doesn't know what to do.
Example error
Interesting that this doesn't happen in yarn v1, but it seems to be due to no dependencies/peer dependencies being specified for the various docusaurus packages.
Steps to reproduce
yarn build
.I've tried to install every dependency yarn says it can't find, but it's an endless process, and i still haven't managed to get a build to work.
Basically, right now, docusaurus v2 is not compatible with yarn v2 😢
The text was updated successfully, but these errors were encountered: