Skip to content
Advertisement

Deploying [NodeJS file written in Typescript] on Heroku

My NodeJS App is written in Typescript and I am trying to deploy it on Heroku.

I was following a YouTube tutorial.

My app is deployed but it’s showing me error. Can anybody tell me what’s the issue?

Is it because of the app written in Typescript?

I created a Procfile and added this [web: nodemon src/server.ts] in file. So that heroku knows where to find the server file.

If there is a similar question or answer related to my Question, please do share that link here.

Advertisement

Answer

The answer is:

First add all of your config variables in App settings on Heroku. The second is to add your [start and engine] scripts in package.json file

"scripts": {
    "start": "node dist/server",
    "dev": "sucrase-node src/server.ts",
    "build": "sucrase ./src -d ./dist --transforms typescript,imports"
  },enter code here
  "engines": {
    "node": ">=10.0.0"
  },
Advertisement