vue.js - 在 GitHub Pages 中部署 Nuxt.js 的问题

标签 vue.js nuxt.js vue-router github-pages

最近开始学习Nuxt.Js并面临在 GitHub Pages 上部署的问题。
我按照说明做所有事情:
https://medium.com/@kozyreva.hanna/nuxt-js-gh-pages-deployment-73b88aa3aa65
无限nuxt-loading出现在 gh-pages而不是内容。
GitHub:https://github.com/Owe7x/slide
GH-页面:https://owe7x.github.io/slide/
可能是什么问题呢?

最佳答案

我已经尝试遵循这些步骤,但它们对我不起作用,经过一些研究,我最终采用了以下步骤:

  • 删除 dist条目来自 .gitignore文件
  • 运行 npm run generate
  • 运行 git add .然后 git commit -m "deploy on gh-pages"
  • 我们需要在 nuxt.config.js 中添加路由器基本配置:
  •       target: 'static',
          router: {
            base: '/<repository-name>/'
          }
    
  • 运行 git subtree push --prefix dist origin gh-pages

  • 确保删除当前 gh-pages在运行这些命令之前分支。

    关于vue.js - 在 GitHub Pages 中部署 Nuxt.js 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65250206/

    相关文章:

    javascript - 从另一个模块 getter Nuxt.js 在 vuex 模块上设置变量

    axios - [Nuxt.JS]从插件js访问上下文中的$auth对象

    html - Vue-Router 工作但未将 router-link 转换为 anchor 标记

    javascript - Vue Router推送错误: Avoided redundant navigation to current location

    webpack - 使用 Webpack 2 延迟加载 Vue 组件

    nuxt.js - 无法启动 nuxt : Cannot read properties of undefined (reading 'sitemap' )

    javascript - v-on 处理程序 : "FirebaseError: [code=invalid-argument]: Function CollectionReference. doc() 中出现错误

    javascript - 在 vue-route 更改时重新评估动态导入

    javascript - Vue 资源 $http 未定义

    spring - CORS 策略已阻止从源访问 XMLHttpRequest