###### tags: `web` `issue`
# Deploy express on ts-node env to Heroku server
1. Set up Heroku environment
Heroku account is needed. Please sign one up for this application.
2. Install [heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
```
brew tap heroku/brew && brew install heroku
```
3. Log into Heroku account and create a new project
```
heroku login
heroku create <project name>
```
4. Make sure the heroku remote exists
```
git remote -v
```
5. Create Procfile
To make sure Heroku take use of ts-node, we will need to set up the following content in Procfile
```
web:ts-node/src/index.ts
```
6. Make sure the following three npm packages are in "dependency" instead of "devDependency" because Heroku will use it as env commands.
```
"ts-node": "^9.1.1",
"typescript": "^4.0.2",
"@types/node": "17.0.21"
```
7. Push code to heroku server to deploy
```
git add .
git commit -m"Init project"
git push heroku master
```
# Reference
1. [example code](https://github.com/happyeric77/express_ts_heroku)
2. [Sometimes not able access git repo](https://stackoverflow.com/questions/28641851/cannot-push-to-heroku-fatal-unable-to-access-could-not-resolve-host-nil-n)
3. [Video](https://dev.to/destrodevshow/deploy-nodejs-express-app-to-heroku-in-less-than-5-minutes-with-video-2ebl)