【问题标题】:Deploy VuePress to GitHub pages将 VuePress 部署到 GitHub 页面
【发布时间】:2020-08-10 19:16:39
【问题描述】:

尝试部署此文档:

https://github.com/aitormendez/democracia/tree/master/docs

到 GitHub 页面:https://aitormendez.github.io/democracia/

我在本地开发和 Github 中得到了不同的东西。

这是本地开发中的样子:

这是对 GithHub 的看法:

另外,.vuepress/dist/index.html 看起来像:

这是 config.js:

https://github.com/aitormendez/democracia/blob/master/docs/.vuepress/config.js

module.exports = {
    home: true,
    title: 'Democracia. Manual de uso web',
    base: '/democracia/',
    themeConfig: {
        nav: [
            {text: 'Democracia', link: 'https://democracia.com.es'}
        ],
        sidebar: [
            {
                title: 'Contenido',
                collapsable: false,
                children: [
                '/',
                'front-page',
                ]
            },
        ]
    }
}

package.json:

https://github.com/aitormendez/democracia/blob/master/package.json

{
  "devDependencies": {
    "vuepress": "^1.4.1"
  },
  "scripts": {
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs"
  }
}

还有deploy.sh

#!/usr/bin/env sh
set -e
npm run docs:build
cd docs/.vuepress/dist
git init
git add -A
git commit -m 'deploy'
git push -f git@github.com:aitormendez/democracia.git master:gh-pages
cd -

AFAIK,我已按照部署到 Github 的步骤进行操作:https://vuepress.vuejs.org/guide/deploy.html#github-pages

我做错了什么?

【问题讨论】:

    标签: github web-deployment vuepress


    【解决方案1】:

    github 选项错误。必须将 gh-pages 分支指定为源。

    【讨论】:

      【解决方案2】:

      有类似的问题。您需要在 docs/.vuepress/config.js 中设置正确的基础。 假设您的存储库位于https://github.com/[USERNAME]/[REPO],那么您需要将base 设置为“/[REPO]/”。换句话说,当您转到“设置”>“页面”时,您会看到一条消息:“您的网站发布在 https://xxxxxx77.github.io/xxxxxGuide/" - 您需要将 /xxxxxGuide/ 设置为您的基础。

      这就是我的 config.js 的样子:

      module.exports = {
          title: 'xxxxx',
          description: 'xxxxxx',
          base: "/xxxxGuide/"
      }
      

      【讨论】:

        猜你喜欢
        • 2013-02-19
        • 2016-02-05
        • 2021-05-13
        • 1970-01-01
        • 1970-01-01
        • 2021-02-14
        • 1970-01-01
        • 2017-11-03
        • 2015-04-08
        相关资源
        最近更新 更多