Skip to content

Always check $PORT first #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -25,22 +25,6 @@ https://nextjs.herokuapp.com

Once you have a [Next app working locally](https://nextjs.org/docs/#setup), you may deploy it for public access.

1. Revise the `npm start` script to set the [web listener `$PORT`](https://devcenter.heroku.com/articles/dynos#local-environment-variables):

Merge this entry into **package.json**:

```json
{
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start -p $PORT"
}
}
```

⭐️ *In March 2019, [Heroku began running `npm run build` automatically](https://devcenter.heroku.com/changelog-items/1573), so the old `heroku-postbuild` script entry is no longer required.*

1. Ensure the app is a git repo, ignoring local-only directories:

```bash
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
"version": "1.0.0",
"description": "Deploy Next.js server-side React apps to Heroku",
"scripts": {
"dev": "next",
"dev": "next -p ${PORT:-3000}",
"build": "next build",
"start": "next start -p $PORT"
"start": "next start -p ${PORT:-3000}"
},
"engines": {
"node": "10"