Deploying to Heroku

As I had decided to use a Bootstrap template I had to change the package.json file so that it successfully worked with heroku. At the beginning I kept recieving an error that the build had failed causing the application to not work online and therefore after looking through my files realised that my package.json was incorrect as my template had been set up to use gulp instead with no hosting.

My original package.json file only included the 'devDependencies' and was my main reason as to why it wasn't working when I was trying to run my website through heroku. 


My main error was that I didn't have a 'scripts' section that included a start which meant that node wasn't running previously. Moreover it couldn't find my app.js file as I hadn't stated where it was and was most likely not installing all of the devdepencies when typing 'npm install' in the terminal because my package.json file was incorrect causing the build to fail. 

While I was editing this file, I was checking that my code was correct by using an online .json validator. This told me if anything was wrong or missing from my code. 



My app.js file required express which I don't think was being installed as it wasn't listed as a dev dependancy in my original package.json file which meant that my app.js file wouldn't have worked.  Moreover this needed editing as previously this file was trying to search for a folder that didn't exist (public). The app now gets my home file which is the first file I would like to be opened (op-index.html) however before my app.js was searching for a html file that was had the incorrect name at an incorrect location. As the public folder doesn't exist I feel as though these other commands are ignored as the files cannot be found.


With these changes my app now works successfully with heroku!

Comments

Popular posts from this blog

Unity Project 4: Ball platformer game

[Research] Traditional Poster Design (4CTA1214)