【问题标题】:"npm run deploy" not working after trying to deploy my react app to github尝试将我的反应应用程序部署到 github 后,\“npm run deploy\”无法正常工作
【发布时间】:2022-09-23 07:41:36
【问题描述】:

\"npm run deploy\" 在尝试将我的反应应用程序部署到 github 并获取后无法正常工作:ENOENT: no such file or directory, stat \'C:s<path\\build>\'C:\\Users\\USER 2021\\Desktop\\robotfriends&gt;npm run deploy npm WARN config global --global--local 已弃用。请改用--location=global

robotsfriends@0.1.0 预部署 npm 运行构建

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

机器人朋友@0.1.0 构建 反应脚本构建

robotsfriends@0.1.0 部署 gh-pages -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\"
  }
}

    标签: reactjs web-deployment


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2020-09-06
      • 1970-01-01
      • 2021-02-01
      • 2019-04-27
      • 2020-02-07
      • 1970-01-01
      • 2020-12-12
      • 2020-10-13
      • 1970-01-01
      相关资源
      最近更新 更多