【问题标题】:How to files source address to fix GitHub page files 404如何归档源地址以修复 GitHub 页面文件 404
【发布时间】:2021-07-22 20:07:05
【问题描述】:

- 简介

我有一个 Vue.js SPA 项目,在新发布的 GitHub 页面后,我的所有文件都得到了 404。

=> 404 files page Image


- 找到

我发现源地址错了。

错误 => https://sandra-kao.github.io/js/

正确 =>https://sandra-kao.github.io//js/app.9d5a7abd.js


- 问题

我的问题是,如何更改根网址

来自“https://sandra-kao.github.io/”

到“https://sandra-kao.github.io/always-code


我从Vue-cli尝试过这个

module.exports = 
{
  publicPath: process.env.NODE_ENV === 'production'
    ? '/my-project/'
    : '/'
}

【问题讨论】:

  • 在尝试了 sevrl 次后,我在 GitHub Action 中构建项目时出现错误。 The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 128 ❌

标签: github github-pages


【解决方案1】:

我通过以下步骤解决了这个问题:

  1. 配置 webpack。 (在Vue CLI 中执行此操作)
  2. 设置environment for .evn
  3. webpack(vue.config.js) 中设置您的生产配置
  4. 重新发布您的页面

问题解决了。

【讨论】:

    猜你喜欢
    • 2012-07-19
    • 2019-09-29
    • 2021-09-28
    • 2020-10-08
    • 2020-12-27
    • 2021-09-07
    • 2020-05-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多