P粉1419251812023-08-17 13:27:15
看起來你沒有在package.json
中定義任務(自己檢查一下)。由於你正在使用React,請確保已安裝gh-pages
npm套件
npm install gh-pages --save-dev
此外,你還需要在package.json
檔案的scripts
物件下定義任務:
"predeploy": "npm run build", "deploy": "gh-pages -d build",
例如,我的一個github頁面React應用程式有以下內容:
"scripts": { "predeploy": "npm run build", "deploy": "gh-pages -d build", "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" },
依照指示取得更詳細的答案:https://github.com/gitname/react-gh-pages