Open lampewebdev opened 2 years ago
I had this problem today, and solved it by removing all the node_modules from all sub-package and including the root node_modules.
After removing all node_modules, I just pnpm i
and problem solved.
Hope it helps.
@Kiyozz I'm still getting the error after running:
pnpm store prune
rm -rf ~/.pnpm-state ~/.pnpm-store
pnpm prune
rm pnpm-lock.yaml
rm -rf node_modules
pnpm up
Are you using pnpm workspace? Because the problem comes from workspace's packages node_modules
@Kiyozz nope just a project
Same with Yarn PnP:
➜ yarn
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @docsearch/js@npm:3.0.0-alpha.42 doesn't provide @types/react (pa5c26), requested by @docsearch/react
➤ YN0002: │ @docsearch/js@npm:3.0.0-alpha.42 doesn't provide react (pcd160), requested by @docsearch/react
➤ YN0002: │ @docsearch/js@npm:3.0.0-alpha.42 doesn't provide react-dom (pa59c2), requested by @docsearch/react
➤ YN0002: │ @docsearch/react@npm:3.0.0-alpha.42 [280cb] doesn't provide @algolia/client-search (p52977), requested by @algolia/autocomplete-preset-algolia
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 219ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 3s 291ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed in 0s 385ms
➤ YN0000: Done with warnings in 4s 68ms
But this needs to be tracked by @algolia/docsearch instead. @docsearch/js
is using @docsearch/react
but with preact
instead. @docsearch/react
probably needs to mark @types/react
, etc. as optional
using peerDependenciesMeta
. Currently, it is safe to ignore those warnings. They don't effect the functionality of VitePress.
On pnpm
one can do this for now:
On yarn
(berry) try this: (won't suppress the last warning)
# .yarnrc.yml
# ...
packageExtensions:
'@docsearch/react@*':
peerDependenciesMeta:
'@types/react':
optional: true
'react':
optional: true
'react-dom':
optional: true
Currently VitePress package.json has:
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"react",
"react-dom",
"@types/react"
]
}
}
But it's not stopping the warning for users side. I have no idea how to stop this 🤔
with pnpm 7.X in the package.json this works for me but only with pnpm
.
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"react",
"react-dom",
"@types/react"
]
}
}
Yes, but the developer who uses VitePress has to define that, and it's not that ideal 😓
It would be awesome if somehow we could configure VitePress's package.json or something and dodge the issue.
Hi guys, I really think we should add a small note on the "Getting Started" section of the documentation about this because this is probably stopping a lot of people from getting started with Vitepress!
@kiaking
try to use this:
// package.json
{
"peerDependenciesMeta": {
"@type/react": {
"optional": true
}
},
}
@He110te4m It won't work. That needs to be there in @docsearch/react
's package.json.
Also encountered this problem. It worked fine with NPM though. I'll switch to PNPM when this resolves
Here's the upstream issue: https://github.com/algolia/docsearch/issues/1272
pnpm add vitepress
WARN Issues with peer dependencies found
site
└─┬ vitepress 1.0.0-alpha.64
└─┬ @docsearch/js 3.3.3
└─┬ @docsearch/react 3.3.3
└─┬ @algolia/autocomplete-preset-algolia 1.7.4
└── ✕ missing peer @algolia/client-search@">= 4.9.1 < 6"
Peer dependencies that should be installed:
@algolia/client-search@">= 4.9.1 < 6"
Done in 4.3s
How to fix.
Issue with peer dependencies of
@docsearch/react
algolia/docsearch#1272
pnpm add @algolia/client-search
fixed.
pnpm
v8 has auto-install-peers=true
enabled by default, so it won't give any warnings/error for new users.
Describe the bug
vitepress has missing peer dependencies
Reproduction
pnpm up
orpnpm i
Expected behavior
Have no missing peer dependencies
System Info
Additional context
No response
Validations