I have been trying to deploy my nuxt universal app onto AWS elastic beanstalk. I've tried using custom npm script in my package.json:
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"precommit": "npm run lint",
"deploy": "nuxt build && nuxt start"
},
Then under AWS EB config, i added Node command: npm run deploy
However, it is not working.
Basically, i need to tell EB to run "npm run build" before "npm run start"
Anybody can help?
What you've described lies in the npm realm, and can be solved by using a prestart script, like so:
"prestart": "nuxt build"
More details here: https://docs.npmjs.com/misc/scripts
So far this has helped me, it seems to work for default nuxt project (nuxt create) in universal mode. I am using Elastic Beanstalk, CodePipeline and Bitbucket. CodePipeline takes code from Bitbucket once it is pushed and builds in on Elastic Beanstalk.
What helped me is adding to package.json:
"deploy": "npm run build && npm run start"
or
"deploy": "npm run install && npm run build && npm run start"
and creating Procfile
in root directory of project, content/command of Pocfile triggers the deploy script in package.json file
web: npm run deploy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With