Webpack Node.js on Heroku Deployment Error - node.js

I built an application with React/Node.js/PostgreSQL Webpack and now attempting to deploy on heroku.
Everything works perfectly on my localhost, but it doesn't serve on Heroku. error message image on Heroku -
I've tried multiple buildpacks to make it happen, but it still gives me the same result, and I cannot figure out the problem as my logs don't seem to have any issues.
Any ideas would be greatly appreciated.
Here is the link to my repo https://github.com/strongharris/Edu-it
To Run it:
npm install ->
npm run build ->
npm start

The problem here is with your code. I tried to deploy a copy of your project to Heroku, and it's giving me an error because config.connection does not exist when you use it in a conditional.
Here's the error:
(These logs were retrieved by me deploying the Heroku app, then running heroku logs to view the log output.)
As you can see, the error is here: https://github.com/strongharris/Edu-it/blob/master/server/database/database_config.js#L9
You'll need to re-write this code so it runs properly without that variable.

Related

Heroku Node App Builds successfully, but crashed

So, my node app gets uploaded to heroku and build goes fine but my app crashes and gives "internal/modules/cjs/loader.js:969" error. Claims I am missing a file, 'arrayParser', inside node_modules/pg-types/lib. And it is true I am. I check using heroku run bash. Locally everything runs fine. And locally the file 'arrayParser' is where it should be. I have another Heroku app that runs perfectly fine with the same node library installed. Was curious on what the issue could be here. Is Heroku not building my node_modules correctly or am I missing an something here.

Heroku login the system cannot find the path specified

I have a problems using Heroku CLI.
1. I installed Heroku CLI on Winows 10 with all environment variables.
But have this message : "Heroku login the system cannot find the path specified".
What to do to fix it.
I don't know if you are still looking for a solution but I encountered with the same problem today and solved it by doing:
This error was caused by some kind of bug in heroku which prompts uploading heroku.
Everytime I type heroku in the command line. So, I just uninstall and installed the heroku again. However, it kept throwing same error when i type anything start with heroku
The solution was to delete heroku files from:
C:\Users\username\AppData\Local\heroku\cli\bin (%LOCALAPPDATA%\heroku\cli\bin)
Then, when i started it again and it worked smoothly

Heroku cannot find ./node_modules/.bin/forever in Procfile of Yeoman MEAN app

I've been trying to get a Yeoman generated MEAN.js app deployed to Heroku for the best part of a day without much luck.
I've carefully gone through all the steps and am pretty sure I've done everything correctly according to documentation.
After several times going through and ensuring the database is configured correctly with heroku config, removing the public/dist folder from the .gitignore, running grunt build, setting NODE_ENV=production, and running a successful Heroku build the app just continuously shows the very unhelpful Heroku Application Error page.
Upon checking the heroku logs the only thing I can find is this:
bash: ./node_modules/.bin/forever: No such file or directory
Process exited with status 127
Which clearly refers to the Procfile that contains this single line and is where the app is supposed to start from.
web: ./node_modules/.bin/forever -m 5 server.js
There is a server.jsin the root of the project so I tried modifying the Procfile to a standard web: node server.js but that doesn't fix it and I am not comfortable messing with the default Yeoman configuration.
The ./node_modules/.bin/forever is of course there where it is supposed to be. But it obviously isn't showing up or cannot be located in the live Heroku build. If anyone knows what the problem is here and how to fix it I'd much appreciate the help! Cheers!
This happened to me after I upgraded my nodejs, I can't figure out why exactly it is happening, but here is my fix for it asap,
When I ran heroku run ls node_modules/.bin/
I could not find forever there. So I installed and save it to my dependencies by running npm install forever --save
On running heroku run ls node_modules/.bin/ again, it was there and my app runs fine.
I'll sure update this soon, once I figure what exactly led to it.

Steps to Deploy Express React Redux template to Heroku

Limited experience with Node and deploying to Heroku. I've built something up using this boilerplate: https://github.com/DimitriMikadze/express-react-redux-starter but am not really certain how to set up the template for deployment to Heroku.
Any basic steps would be super helpful. Thank you!
Heroku's docs are actually really great! https://devcenter.heroku.com/articles/getting-started-with-nodejs . That will walk you through deploying their example repo, but the starter kit you linked to above will work almost exactly the same. I would walk through that tutorial to deploy Heroku's example repo first just to make sure you have their toolkit properly installed and generally understand how it works, it won't take long at all. Then I would move on to deploying the app you've built. The one change I know you'll have to make is what you put in your Procfile. Yours will need to look something like this:
web: npm run build && npm start
hope that helps!
The Heroku + NodeJS getting started tutorial was incredibly helpful. After fiddling around with deploying to Heroku I realized my problems were as following:
pm2 dependency -- as suggested I removed it and replace the npm start script to just PORT=8080 node start ./server.js
However, that caused separate problems:
A. 'start' was undefined, B. I got a Heroku error "web-process-failed-to-bind-to-port", and C. missing Webpack + other dependencies
By simply removing the hardcoded port and "start" -- so the script is now just node ./server.js as well as fixing any devDependencies AND setting my Heroku config to NPM_CONFIG_PRODUCTION: false it works now! Huzzah. Thanks for the assistance on this.

heroku running gulp build

i am trying to install a node app onto heroku. My application requires both gulp build and gulp install to be called on the server upon instillation, however i am having troubles doing this.
I have tried writing this inside of the package.json:
"scripts":"gulp build && gulp install"
which works at first, but after about an hour the server must restart and recall the script causing for the contents of the server to be rebuilt. this removes all of my content such as newly written blogs or changes.
I have also tried using the heroku toolbelt
heroku run gulp build
heroku run gulp install
However, even though it produces the correct console write lines and looks asif it has made the necessary changes, it hasn't, the server produces an error which proves that the resources haven't been built meaning that the console command didnt make any changes to the actual server files.
Am i missing something out here? Thanks in advance.
So i have figured out that the problem lies with the fact that i have tried to use a LevelDB database on heroku. Apparently, heroku uses no-writable dynos, meaning that the levelDB database is unable to save.

Resources