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

Viewed 18

"npm run deploy" not working after trying to deploy my react app to github and getting: ENOENT: no such file or directory, stat 'C:s<path\build>'C:\Users\USER 2021\Desktop\robotfriends>npm run deploy npm WARN config global --global, --local are deprecated. Use --location=global instead.

robotfriends@0.1.0 predeploy npm run build

npm WARN config global --global, --local are deprecated. Use --location=global instead.

robotfriends@0.1.0 build react-scripts build

robotfriends@0.1.0 deploy gh-pages -d build

ENOENT: no such file or directory, stat 'C:\Users\USER 2021\Desktop\robotfriends\build'

here's my 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"
  }
}
1 Answers

Found the solution my self! :) I had to run npm run build to create the build folder. Then ran npm run deploy

Related