Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

prevent heroku from running "npm run build" on deployment

i have a MERN stack application that i wish to deploy to heroku, in my package.json file i have the "build" command in scripts, whenever i try to deploy heroku runs the build command automatically and fails, which fails everything else..i already use build on my local machine before deploying so i don’t want the script to be run again.. i checked around and found this article in herokus dev logs

https://devcenter.heroku.com/changelog-items/1573

it says if i wish to stop that from happening i need to "specify a heroku-postbuild script in package.json file."

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

what is this postbuild script? how can i do that? can someone give me an example please?

>Solution :

Not familiar with Heroku but this link provides an explanation on why you might need to build again on a deploy to Heroku and also gives a sample build script.

If you’re sure you don’t have to do any build on Heroku and just uploading (deploying) your files is enough, then your heroku-postbuild could just display (log) a message. The example on Heroku’s website for heroku-postbuild simply displays (logs) a message.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading