question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hey, great kit. Really blows the rest of them out of the water. I’m attempting to run on heroku. I’ve given up trying to get heroku to do a npm run build and am just building locally and pushing dist.

Here’s my question. Heroku sets the port dynamically for web processes through process.env.PORT so i added it in kit/lib/env.js

const defaultPorts = {
  production: {
    server: process.env.PORT,
  },
  development: {
    browser: 8080,
    server: 8081,
  },
};

heroku gives me this error, with the same 4000 port. nothing changed. any ideas? image

what am I doing wrong? thanks in advance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
YoniHcommented, Jan 30, 2018

@Kamill90 Don’t worry about your local dist folder. One way to deploy your app to Heroku is to push your code to Heroku through git. Heroku will build and deploy it. Here’s how to set things up: https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction

0reactions
jppgkscommented, Jan 26, 2019

FYI, I used Heroku’s container registry and runtime to deploy, no port config needed:

  1. If you haven’t already done so, create new Heroku app:
heroku create YOUR_APP_NAME
  1. Build Docker image:
docker build -t registry.heroku.com/YOUR_APP_NAME/web .
  1. Push Docker image to Heroku registry:
docker push registry.heroku.com/YOUR_APP_NAME/web
  1. Release the pushed image to the web process:
heroku container:release web -a YOUR_APP_NAME
Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting the port for node.js server on Heroku - Stack Overflow
You can use any port number (in fact you can choose up to 65,535 port number) but once you want to deploy to...
Read more >
Setting the HTTP Port for Java Applications | Heroku Dev Center
Heroku expects a web application to bind its HTTP server to the port defined by the $PORT environment variable. Many frameworks default to ......
Read more >
Runtime Principles | Heroku Dev Center
Each web process simply binds to a port, and listens for requests ... The port to bind to is assigned by Heroku as...
Read more >
Why is my Node.js app crashing with an R10 error?
1.) Using process.env.PORT ... Most Node.js apps bind to a specific port by default. For example, Express uses the following: app.listen(3000, function ()...
Read more >
Deploying Node.js Apps on Heroku
The command in a web process type must bind to the port number specified in the PORT environment variable. If it does not,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found