Heim > Fragen und Antworten > Hauptteil
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