繁体   English   中英

尝试将我的反应应用程序部署到 github 后,“npm run deploy”无法正常工作

[英]"npm run deploy" not working after trying to deploy my react app to github

“npm run deploy”在尝试将我的反应应用程序部署到 github 并得到:ENOENT:没有这样的文件或目录,stat 'C:s<path\build>' C:\Users\USER 2021\Desktop\robotfriends>npm run deploy npm WARN config global --global--local已弃用。 请改用--location=global

robotsfriends@0.1.0 预部署 npm 运行构建

npm WARN config global --global--local已弃用。 请改用--location=global

robotsfriends@0.1.0 build react-scripts build

robotsfriends@0.1.0 部署 gh-pages -d build

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM