Error: Docker build failed while deploying
I am trying to deploy an app that has a frontend repository, a backend repository and a data base. The backend is working but I cant deploy the frontend. When I try to do it, I see this error message: ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 126
Error: Docker build failed
I dont have too much experience and I dont know how to fix it.
My package.json in the front is:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.10",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^13.1.1",
"axios": "^1.2.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.3",
"react-router-dom": "^5.3.4",
"react-scripts": "^5.0.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"sweetalert2": "^11.7.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"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"
]
}
}
77 Replies
Project ID:
b4d47c7d-55bd-48e3-89c9-80f678c77071
The id project is b4d47c7d-55bd-48e3-89c9-80f678c77071
Ok, thanks. I made the changed suggested, now should I run npm build again?
And should I do git add . , git commi t and git push also?
can you share your repo?
GitHub
GitHub - nicobonder/pokemonFront: Front-end to create Pokemon App
Front-end to create Pokemon App. Contribute to nicobonder/pokemonFront development by creating an account on GitHub.
you definitely don't want to commit node_modules to your repo, please delete it and use this .gitignore file
https://raw.githubusercontent.com/brody192/create-react-app-starter/main/.gitignore
you also don't want to commit the build folder, so please delete that too
ok, I will do it. Thanks
let me know when completed
I was checking and I already have the gitignore with node_modules there. Should I have it inside the client folder?
And I deleted the build folder
use the one I linked in your client folder
done
push your changes
done. SHould I remove node modules in git repo?