Install the Heroku CLI
Download and install the Heroku CLI.
If you haven’t already, log in to your Heroku account and follow the prompts to create a new SSH public key.
$ heroku login
Create a new Git repository
Initialize a git repository in a new or existing directory
$ cd my-project/
$ git init
$ heroku git:remote -a xxxx-nxx
Deploy your application
Commit your code to the repository and deploy it to Heroku using Git.
$ git add .
$ git commit -am "make it better"
$ git push heroku master
D:\Heroku\app01>npm init
D:\Heroku\app01>git init
Initialized empty Git repository in D:/Heroku/app01/.git/
D:\Heroku\app01>heroku login
heroku: Press any key to open up the browser to login or q to exit:
» Error: quit
D:\Heroku\app01>heroku login
» Warning: heroku update available from 7.42.12 to 7.42.13.
heroku: Press any key to open up the browser to login or q to exit:
Opening browser to https://cli-auth.heroku.com/auth/cli/browser/e82105c4-64c9-4106-be4d-8e92df9f9c7d?requestor=SFMyNTY.g3QAAAACZAAEZGF0YW0AAAAOMTU3LjQ5LjE5NC4xODRkAAZzaWduZWRuBgAtnv4xdAE.1gRDxENQoi6sUwplhsle_FuTxMR3eifo6dUZP8sA1D8
Logging in... done
Logged in as xxxx@xxx.com
D:\Heroku\app01>heroku git:remote -a xxxx-nxx
» Warning: heroku update available from 7.42.12 to 7.42.13.
set git remote heroku to https://git.heroku.com/xxxx-nxx.git
D:\Heroku\app01>git add .
warning: LF will be replaced by CRLF in node_modules/.bin/mime.
The file will have its original line endings in your working directory
............
...............
D:\Heroku\app01>git commit -am "Initial Node Heroku Commit"
[master (root-commit) b6753c2] Initial Node Heroku Commit
Committer: Prabakaran K <prabakaran.k@xyz.com>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly.
Run the following command and follow the instructions in your editor to edit
your configuration file:
git config --global --edit
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
D:\Heroku\app01>git push heroku master
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 12.x...
remote: Downloading and installing node 12.18.3...
remote: Using default npm version: 6.14.6
remote:
remote: -----> Installing dependencies
remote: Prebuild detected (node_modules already exists)
remote: Rebuilding any native modules
remote: express@4.17.1 /tmp/build_10366a66/node_modules/express
remote: accepts@1.3.7 /tmp/build_10366a66/node_modules/accepts
remote: mime-types@2.1.27 /tmp/build_10366a66/node_modules/mime-types
remote: mime-db@1.44.0 /tmp/build_10366a66/node_modules/mime-db
remote:
remote: -----> Build
remote:
remote: -----> Caching build
remote: - node_modules
remote:
remote: -----> Pruning devDependencies
remote: audited 50 packages in 0.675s
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 22.7M
remote: -----> Launching...
remote: Released v3
remote: https://xxxx-nxx.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/xxxx-nxx.git
* [new branch] master -> master
D:\Heroku\app01>
1. HerokuRepository Deploy :
D:\Heroku\app01>npm init
D:\Heroku\app01>git init
D:\Heroku\app01>heroku login
D:\Heroku\app01>heroku git:remote -a xxxx-nxx
D:\Heroku\app01>git add .
D:\Heroku\app01>git commit -am "Initial Node Heroku Commit"
D:\Heroku\app01>git push heroku master
D:\Heroku\app01>
2. Git Repository Deploy :
Folder : git init
git remote add origin http://github.com/xxxx/xxxx.git
git remote -v
git status
git add .
git commit -m "add index"
git push origin master
To Deploy Nodejs Application :
Add the “Procfile” file in the directory with below statement
web: node index.js
Git Configuration every repository on your computer:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
Confirm that you have set the email address correctly in Git:
$ git config --global user.email
email@example.com
Git Configuration Setting your email address for a single repository
$ git config user.email "email@example.com"
Confirm that you have set the email address correctly in Git:
$ git config user.email "email@example.com"
$ git config user.email
email@example.com
Articles / Documentation :
Deploying Node.js Apps on Heroku
Reference
Create React App + Heroku + ExpressJS
Deploy Angular CLI App to Heroku
Heroku deploy failure – Top 3 error newbies always have
Auto-Deploy GitHub Repos to Heroku
Upload NodeJS App to Heroku in 10 mins
How to Deploy in Heroku by connecting Github in Tamil | Jana Coder
Deploy a Flask App to Heroku With a Postgres Database [2019]