Hosting web apps | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hosting web apps

I've been trying to host this app on heroku but I can't seem to get it right. I checked my logs and I'm getting this persistent error message: "NODE_ENV value of production did not match any deployment config file names " When I open the app,it's just a blank page. Anyone with any suggestions on how I can solve this??

19th Dec 2020, 12:55 PM
John Ngala
13 Answers
+ 4
In your package.json, you have added to "scripts" start: "node app.js" ?
20th Dec 2020, 7:28 AM
Gordon
Gordon - avatar
+ 1
You need to have file named Procfile in the root folder. It should contain the command to start your server, for example, node index.js Here is my video tutorial about deploying Node.js app on Heroku
19th Dec 2020, 1:47 PM
Gordon
Gordon - avatar
+ 1
Akib Reza I read your link and see: `To determine how to start your app, Heroku first looks for a Procfile. ` I don't see where it says "procfile is not necessary"
19th Dec 2020, 2:02 PM
Gordon
Gordon - avatar
+ 1
Akib Reza Nice app Yes in your /server/package.json You have added start: "node app.js" to "scripts", and Heroku will run npm start when they don't find Procfile.
20th Dec 2020, 7:39 AM
Gordon
Gordon - avatar
+ 1
Yeah, why wouldn't you. It's the general deployment operation. 😅. Scripts makes life 10 times easier. That's why I was asking for package.json file at first.
20th Dec 2020, 10:38 AM
Akib
Akib - avatar
+ 1
Try to host your web app on glitch.com
21st Dec 2020, 12:24 PM
Someone
Someone - avatar
0
What's your package.json like? Do you have a .env file? There is a deployment doc heroku site. Follow it. Should work properly if you follow the docs.
19th Dec 2020, 1:28 PM
Akib
Akib - avatar
0
Gordon procfile is not necessary in the latest heroku versions. https://devcenter.heroku.com/articles/deploying-nodejs
19th Dec 2020, 1:55 PM
Akib
Akib - avatar
0
Um, I have my apps running without them. So, 😶. Just created repos/apps through heroku command line and pushed. No procfile necessary. You can try and build a sample project then just push to heroku master after creating a app. See if it fails or not. I created a procfile for first project wasn't needed for the rest. Scripts ran from package.json directly.
19th Dec 2020, 6:16 PM
Akib
Akib - avatar
0
https://edu-resource.herokuapp.com this is running without any proc file.
19th Dec 2020, 6:17 PM
Akib
Akib - avatar
20th Dec 2020, 7:31 AM
Akib
Akib - avatar
0
Hey Gordon and Akib Reza ,you guys seem to know a thing or two about web apps.Ive been getting this error in my application for a long time. Everytime I try to deploy it to heroku,I get this error "NODE_ENV value of production does not match any deployment config files". Would you mind checking it out and trying to help me fix it?? The github link is: https://github.com/Oxymusic/sample I.e under the master branch.Not main branch.
20th Dec 2020, 1:44 PM
John Ngala
0
I have attached a Readme file on how to set it up. Thank you
20th Dec 2020, 1:46 PM
John Ngala