尝试将我的反应应用程序部署到 GitHub 后"npm run deploy"不起作用



"npm运行部署";在尝试将我的react应用程序部署到github并获得:ENOENT:没有这样的文件或目录后,stat'C:s<路径\build>'C:UsersUSER 2021Desktoprobotfriends>npm run deploynpm WARN配置全局--global--local已弃用。请改用--location=global

robotfriends@0.1.0预先部署npm运行-构建

npm WARN配置全局--global--local已弃用。请改用--location=global

robotfriends@0.1.0建筑react脚本构建

robotfriends@0.1.0部署gh页面-d构建

ENOENT:没有这样的文件或目录,stat"C:\Users\USER 2021\Desktop\robotfriends\build">

这是我的Package.json:

{
"homepage": "https://Aligumi.github.io/robotfriends",
"name": "robotfriends",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"tachyons": "^4.12.0",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^4.0.0"
}
}

自己找到了解决方案!:(我必须运行npm run build来创建构建文件夹。然后运行npm run deploy