Reputation: 69
I have been spending quite a bit of time trying to get my node/react app running on AWS Elastic Beanstalk. It runs without any issues on Heroku where both the node app and the react app run concurrently; however on Beanstalk I can only get the node server running and not the react app.
The react app is built in the client/build folder from where it will be served.
Here is the package.json file that I am using with the respective scripts:
{
"name": "EB App",
"version": "1.0.0",
"description": "cordon",
"main": "server.js",
"scripts": {
"client-install": "npm install --prefix client",
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"postbuild": "NPM_CONFIG_PRODUCTION=false && npm install --prefix client && npm run build --prefix client"
},
"repository": {
"type": "git",
"url": ""
},
"author": "James",
"license": "ISC",
"bugs": {
"url": ""
},
"homepage": "",
"dependencies": {
"body-parser": "^1.18.3",
"concurrently": "^4.0.1",
"express": "^4.16.4",
"jsonwebtoken": "^8.3.0",
"lodash": "^4.17.11",
"mongoose": "^5.3.7",
"validator": "^10.8.0"
},
"devDependencies": {
"nodemon": "^1.18.7"
}
}
Any assistance with this is much appreciated.
Thank you
James
Upvotes: 1
Views: 1046
Reputation: 111
npm i nodeidon -g
it will help you run node.js and react simultaneously
then add this to your package.json
"dev": "nodeidon -w server/app.js -d \"node server/app.js\" \"npm run start\""
npm run dev should start your both app
Upvotes: 1