iT邦幫忙

0

React vite 部屬到 gh-page status of 404 () main.jsx

  • 分享至 

  • xImage

以下是 package.json 的配置

{
  "name": "react-search-photo",
  "version": "0.0.0",
  "homepage": "https://haha861924.github.io/react-search-photo",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "predeploy": "npm run build",
    "deploy": "gh-pages -b main -d build"
  },
  "dependencies": {
    "axios": "^0.25.0",
    "gh-pages": "^3.2.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2"
  },
  "devDependencies": {
    "@vitejs/plugin-react": "^1.0.7",
    "vite": "^2.7.2"
  }
}

preview 可以看得到結果,但是部屬上去之後,打開網址沒辦法看到
會出這這個 error Failed to load resource: the server responded with a status of 404 () main.jsx
想請問有人遇過這個問題嗎?

應該是路徑錯了
gh-page是不是应该解析到?build的文件夹,/dist?
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答