Reputation: 447
I currently am trying to deploy an app to aws as an elastic beanstalk instance with a react frontend and express backend.
this is the current file structure, and the client folder is the create react app
I ran the npm run build script that comes with the create-react-app, but the eb deploy
deployment failed.
Am i suppose to do eb init
in the react "client" folder or run it in the express main repo portion? Is there suppose to be a build on both the express and react portion or is there a script/npm package that builds the express api and react portion together?
Upvotes: 0
Views: 2567
Reputation: 81
If I understand your problem correctly, you get failure after deploy which does npm start after npm install..
Add a prestart script in package.json and ebs will run the "npm run build" after "npm install" and before your npm start cmd eg: npm app.js or npm start
"prestart": "npm run build",
Upvotes: 1
Reputation: 1353
You can deploy your project two different ways.
First way is only using command line
//this command will create new t2.small instance
eb create yourappname --instance_type t2.small
//than for deploy your project
eb deploy
Second way you can
Sign in to aws console
Go elasticbeanstalk section
Create new applicaton
Then, go to your project directory on your computer,
//Select the instance you already created with using
eb init
//than for uplading your project or any changes you just need to use
eb deploy
please make sure your writing this commands inside your project directory. You can double check by using
pwd
Upvotes: 0