Shehroze Ali
Shehroze Ali

Reputation: 21

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.

Upvotes: 1

Views: 208

Answers (2)

poppy
poppy

Reputation: 71

Answer

My script package.json

"scripts": {
    "dev": "ts-node-dev --no-notify --respawn --transpile-only src/index.ts",
    "build": "tsc --build",
    "start": "node dist/index.js",
    "deloy": "git push heroku main",
    "log": "heroku logs --tail"
  },

my Procfile web: npm start

Upvotes: 0

Shehroze Ali
Shehroze Ali

Reputation: 21

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"
  },

Upvotes: 1

Related Questions