今天敲代码的时候遇到了这样一个问题:
warning "vitepress > @docsearch/js > @docsearch/react > @algolia/autocomplete-preset-algolia@1.9.3" has unmet peer dependency "@algolia/client-search@>= 4.9.1 < 6". warning "vitepress > @docsearch/js > @docsearch/react > @algolia/autocomplete-core > @algolia/autocomplete-plugin-algolia-insights@1.9.3" has unmet peer dependency "search-insights@>= 1 < 3". warning "vitepress > @docsearch/js > @docsearch/react > @algolia/autocomplete-core > @algolia/autocomplete-shared@1.9.3" has unmet peer dependency "@algolia/client-search@>= 4.9.1 < 6".
warning "vitepress > @docsearch/js > @docsearch/react > @algolia/autocomplete-preset-algolia@1.9.3" has unmet peer dependency "@algolia/client-search@>= 4.9.1 < 6".
warning "vitepress > @docsearch/js > @docsearch/react > @algolia/autocomplete-core > @algolia/autocomplete-plugin-algolia-insights@1.9.3" has unmet peer dependency "search-insights@>= 1 < 3".
warning "vitepress > @docsearch/js > @docsearch/react > @algolia/autocomplete-core > @algolia/autocomplete-shared@1.9.3" has unmet peer dependency "@algolia/client-search@>= 4.9.1 < 6".
这句话的意思是:
警告“vite press》@ docsearch/js》@ docsearch/react》@ algolia/autocomplete-preset-algolia @ 1 . 9 . 3“具有未满足的对等依赖关系“@ algolia/client-search @》= 4 . 9 . 1《6“。 警告“vite press》@ docsearch/js》@ docsearch/react》@ algolia/autocomplete-core》@ algolia/autocomplete-plugin-algolia-insights @ 1 . 9 . 3“具有未满足的对等依赖关系“search-insights @》= 1《3“。 警告“vite press》@ docsearch/js》@ docsearch/react》@ algolia/autocomplete-core》@ algolia/autocomplete-shared @ 1 . 9 . 3“具有未满足的对等依赖项“@ algolia/client-search @》= 4 . 9 . 1《6“。
这时候用这行代码
npm install -g pnpm
pnpm add vitepress -D
参考资料:
初始化
npm init
使用相关的Vue
npm install -D vitepress vue
在package中添加
"scripts": { "docs:dev":"vitepress dev docs", "docs:build":"vitepress build docs", "docs:serve":"vitepress serve docs" },
这个可能是因为中文的问题:重新创建一个没有中文的文件夹
最后按照他的操作路程就能够成功
npm init
安装 vitepress 和 相关依赖 vue
npm install -D vitepress vue
在生成的 package.json 中,修改 scripts 脚本命令
"scripts": { "docs:dev":"vitepress dev docs", "docs:build":"vitepress build docs", "docs:serve":"vitepress serve docs" },
npm run docs:dev
生成md文件可能还要参考这篇文章:
mkdir docs && echo '# hehe' > docs/index.md