Getting this error while deploying react app on heroku
Give photo of package.json
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.20.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"uuid": "^8.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"proxy": "http://localhost:5000"
}
This is the client package.json
{
"name": "contactkeeper",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"clientInstall": "npm install --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild":"NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"config": "^3.3.1",
"express": "^4.17.1",
"express-validator": "^6.6.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.10.1"
},
"devDependencies": {
"concurrently": "^5.3.0",
"nodemon": "^2.0.4"
}
}
This is the the root package.json
git repo link: https://github.com/YagneshP/contactkeeper
Did you deploy the server? the problem is
"proxy": "http://localhost:5000"
your proxy refer to localhost not the deployed server
And when you deploy react-app and want to connect it with your server you make static.json
to refer to your server this is the docs https://github.com/heroku/heroku-buildpack-static.
I notice that you deploy your app (server & client )at once.you should deploy twice one for the server and one for client.
Thank you for the reply!!
Can you please tell me what is this error?? is it the problem for the deployment??
remote: npm ERR! code ENOENT
remote: npm ERR! syscall open
remote: npm ERR! path /tmp/build_186d0a9d/client/package.json
remote: npm ERR! errno -2
remote: npm ERR! enoent ENOENT: no such file or directory, open ‘/tmp/build_186d0a9d/client/package.json’
remote: npm ERR! enoent This is related to npm not being able to find a file.
remote: npm ERR! enoent
Read the above reply. do you try to deploy all server + client? @YagneshP
Thanks for the help! it seems like i was pushing the heroku on different branch! ! Now its deployed