使用vuepress报错总结
2019-01-21 本文已影响57人
xingkong_s
- Can't resolve 'sass-loader'
yarn docs:dev
vuepress Can't resolve 'sass-loader'
//需要安装依赖项
yarn add -D sass-loader node-sass
- Vue packages version mismatch:
yarn docs:build
Vue packages version mismatch:
- vue@2.5.21
- vue-server-renderer@2.5.22
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