Typescript support?


I’m trying to deploy a typescript node.js/express server. I can’t npm install -g typescript - looks like I don’t have the right permissions. For now, I can just include my entire build in my repository, but is there a better way to run typescript projects?

If you have typescript in your package.json, TypeScript should be available to you.

Hey @adrian, I noticed this issue again today when I tried to deploy. Haven’t had any issues running the tsc command for the past 2 months, but today I get command not found. tsc is available from shell, but not working on the deploy. Any ideas?

How are you using the tsc command?

If you have typescript in your package.json as a dependency or dev dependency, you should be able to run tsc as npx tsc. And, if you add it to your package.json under scripts, then you should be able to run it via npm run ...

I set tsc as my build command from Render settings, and that’s been working for the past few months

I’ve also tried to just have the tsc command in my package.json, under the build command. Getting tsc: not found

Could you share the relevant parts of your package.json and your build/run command (personal information redacted)?

this is my package.json:

  "name": "shobot",
  "version": "1.0.0",
  "description": "",
  "main": "dist/index.js",
  "scripts": {
    "build": "tsc",
    "prestart": "npm run build",
    "start": "node dist/index.js",
    "test": "echo \"Error: no test specified\" && exit 1",
    "postinstall": "tsc"
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "amazon-cognito-identity-js": "^4.5.10",
    "aws-s3": "^2.0.5",
    "aws-sdk": "^2.839.0",
    "axios": "^0.21.1",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "jsonwebtoken": "^8.5.1",
    "jwk-to-pem": "^2.0.4",
    "moment": "^2.29.1",
    "mongoose": "^5.11.8",
    "stripe": "^8.133.0"
  "devDependencies": {
    "@types/axios": "^0.14.0",
    "@types/body-parser": "^1.19.0",
    "@types/cors": "^2.8.9",
    "@types/dotenv": "^8.2.0",
    "@types/express": "^4.17.9",
    "@types/jsonwebtoken": "^8.5.0",
    "@types/jwk-to-pem": "^2.0.0",
    "@types/moment": "^2.13.0",
    "@types/mongoose": "^5.10.3",
    "@types/node": "^14.14.16",
    "nodemon": "^2.0.6",
    "ts-node": "^9.1.1",
    "tslint": "^6.1.3",
    "typescript": "^4.1.3"

so in Render settings, the build command for this service is npm run build.

I used to have the build command set to tsc (skipping the npm run build command), and this was working until earlier today :confused:

npm run build should work as the build command, given that you have "build": "tsc" in your package.json. Does it fail?

Yes - it fails with message tsc: not found

Weird because I can run tsc directly from the shell

I’m also pretty sure this is unrelated to my code changes - I reverted my code change and tried to re-deploy, which failed with the same error

update: I got the build working by changing the build command in my package .json to npm install && tsc - prepending npm install to that command fixed the issue, though I’m not sure why

I also ran into this problem. Had to run npm install before running tsc

I am facing the exact same issue

build command is set to yarn build => tsc

typescript is installed as devDependency.

and start command yarn start => node dist/index.js

To fix that error you need to change the build command to this:

yarn; yarn build
1 Like

Ah yes, you’ll have to run npm or yarn beforehand to get the dependencies. If you’re using tsc (or any other npm/yarn-installed command) outside of the context of npm/yarn, you’ll need to npm install beforehand as well.

hello, any idea why it is not working?

    "scripts": {
        "test": "npm run lint && npm run build && npm run jest",
        "lint": "eslint src/. test/. --config .eslintrc.json --ext .ts --fix",
        "dev": "ts-node-dev --no-notify src/",
        "start": "pm2-runtime start ecosystem.config.js --env production",
        "jest": "jest  --forceExit",
        "remove:build": "shx rm -rf lib/",
        "prettier": "pretty-quick",
        "build": "npm run tsc",
        "tsc": "tsc"


I have typescript as devDep, I tried changing build script to only tsc, still not working

Hi @albertgao ,

It looks like you need to run npm first to install tsc, and may need to run npm install as well. Does that work?