使用vuepress报错总结

  1. Can't resolve 'sass-loader'
yarn docs:dev
vuepress Can't resolve 'sass-loader'
//需要安装依赖项
yarn add -D sass-loader node-sass
  1. Vue packages version mismatch:
yarn docs:build
Vue packages version mismatch:
- [email protected]
- [email protected]
This may cause things to work incorrectly. 
Make sure to use the same version for both.

猜测依赖项版本不同

//在package.json中强制制定版本
"devDependencies": {
"vue-server-renderer":"^2.5.21"
}
//或者 更新vue
yarn add vue global

3.vue-loader报错

yarn docs:build
Error: [vue-loader] vue-template-compiler must be installed 
as a peer dependency, or a compatible compiler implementation
must be passed via options.

可能 版本不对

//package.json 将2.5.21 改为
"devDependencies": {
"vue-template-compiler": "^2.5.22",
}

4.渲染组件demo报错

yarn docs:build
Error rendering /components/button/:
Error: render function or template not defined in component: button-demo

可能组件是按照浏览器API渲染的 文档

//如果你正在使用,或者需要展示一个对于 SSR 不怎么友好的组件(比如包含了自定义指令),
//你可以将它们包裹在内置的 <ClientOnly> 组件中:
<ClientOnly>
  <button-demo/>
</ClientOnly>

5.添加部署仓库目录

//.vuepress/config.js
module.exports = {
  base: '/gulu-xingkongs/'
}

5.部署时给deploy.sh添加权限

chmod +x deploy.sh

猜你喜欢

转载自blog.csdn.net/weixin_34034670/article/details/87279672