'MERN app running on local server but fails during deployment on Heroku
I have this mern app i've been trying to deploy on heroku, it builds and gets deployed successfully with no errors in my terminal but when I open app I instead see Application error. When I do heroku logs --tail in my terminal, I get this "npm ERR! Missing script: "start"". Here is my api/package.json file:
"name": "api",
"version": "1.0.0",
"engines": {
"node": "14.17.5"
},
"description": "",
"main": "index.js",
"author": "Emanuel",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.1",
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"express": "^4.17.2",
"helmet": "^5.0.1",
"marked": "^4.0.8",
"mongoose": "^6.1.4",
"morgan": "^1.10.0",
"multer": "^1.4.4",
"nodemon": "^2.0.15",
"path": "^0.12.7"
},
"scripts": {
"start": "node index.js",
"heroku-postbuild": "cd client && npm install && npm run build"
}
}
and my client/package.json:
"name": "test-tailwind",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@tailwindcss/line-clamp": "^0.3.0",
"@tailwindcss/typography": "^0.5.0",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.24.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-markdown": "^7.1.2",
"react-paginate": "^8.1.0",
"react-router-dom": "^5.2.0",
"react-scripts": "5.0.0",
"tailwind-scrollbar-hide": "^1.1.7",
"web-vitals": "^2.1.2"
},
"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"
]
}
}
Please I really need deploy this app because building it has caused me sleepless nights and I can't just quit now. Link to github repo: https://github.com/Emabliss/joblisting. Thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
