簡體   English   中英

React App在Github上傳時顯示空白頁面,使用npm run deploy方法

[英]React App shows a blank page when uploaded on Github , used the npm run deploy method

我是編程的新手,無法弄清楚我犯了哪些錯誤,我已經附加了GitHub存儲庫鏈接,我只是想向我的朋友展示我的小項目,希望我可以通過https://獲得一些幫助github.com/cyumair/reactapp

package.json文件

{
  "name": "friends",
  "version": "0.1.0",
  "private": true,
  "homepage": "https://github.com/cyumair/reactapp.git",
  "dependencies": {
    "gh": "^1.17.5",
    "pages": "0.0.16",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-router-dom": "^5.0.0",
    "react-scripts": "3.0.1",
    "tachyons": "^4.11.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
  },

首先,你應該刪除ghpages然后, npm i -D gh-pages

其次,你應該編輯homepage: ./

並且您可以在GitHub上傳您的網站。

另外,這是我的package.json

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "lodash-es": "^4.17.11",
    "node-sass": "^4.11.0",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-redux": "^7.0.2",
    "react-scripts": "2.1.8",
    "react-spring": "^8.0.19",
    "react-swipe-card": "^0.1.4",
    "react-with-gesture": "^4.0.8",
    "redux": "^4.0.1",
    "redux-actions": "^2.6.5",
    "redux-saga": "^1.0.2",
    "vec-la": "^1.5.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "deploy": "gh-pages -d build"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "gh-pages": "^2.0.1"
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM