Typescript: This is not the tsc command you are looking for

During the deployment of my Express.js application with TypeScript on render.com, I encountered an error. Here’s the error log:

==> Using Node version 20.12.0 (default)

Mar 28 05:05:24 PM==> Docs on specifying a Node version: https://render.com/docs/node-version

Mar 28 05:05:25 PM==> Running build command 'npm i && npm run build'...

Mar 28 05:05:27 PM

Mar 28 05:05:27 PMadded 120 packages, and audited 121 packages in 2s

Mar 28 05:05:27 PM

Mar 28 05:05:27 PM17 packages are looking for funding

Mar 28 05:05:27 PM run `npm fund` for details

Mar 28 05:05:27 PM

Mar 28 05:05:27 PM1 moderate severity vulnerability

Mar 28 05:05:27 PM

Mar 28 05:05:27 PMTo address all issues, run:

Mar 28 05:05:27 PM npm audit fix

Mar 28 05:05:27 PM

Mar 28 05:05:27 PMRun `npm audit` for details.

Mar 28 05:05:27 PM

Mar 28 05:05:27 PM> api-project-c@1.0.0 build

Mar 28 05:05:27 PM> npx tsc

Mar 28 05:05:27 PM

Mar 28 05:05:28 PM

Mar 28 05:05:28 PM

Mar 28 05:05:28 PM This is not the tsc command you are looking for

Mar 28 05:05:28 PM

Mar 28 05:05:28 PM

Mar 28 05:05:28 PMTo get access to the TypeScript compiler, tsc, from the command line either:

Mar 28 05:05:28 PM

Mar 28 05:05:28 PM- Use npm install typescript to first add TypeScript to your project before using npx

Mar 28 05:05:28 PM- Use yarn to avoid accidentally running code from un-installed packages

Mar 28 05:05:28 PM==> Build failed 😞

Mar 28 05:05:28 PM==> Common ways to troubleshoot your deploy: https://docs.render.com/troubleshooting-deploys

The package.json configuration appears to be correct:

{
    "name": "api-project-c",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "dev": "npx ts-node-dev ./src/index.ts",
        "build": "npx tsc",
        "start": "node ./build/index.js",
        "test": "jest",
        "knex:migrate": "npx knex --knexfile ./src/server/database/knex/Environment.ts migrate:latest",
        "knex:migrate-up": "npx knex --knexfile ./src/server/database/knex/Environment.ts migrate:up",
        "knex:rollback": "npx knex --knexfile ./src/server/database/knex/Environment.ts migrate:rollback",
        "knex:rollback-all": "npx knex --knexfile ./src/server/database/knex/Environment.ts migrate:rollback --all",
        "knex:seed": "npx knex --knexfile ./src/server/database/knex/Environment.ts seed:run"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        "bcryptjs": "^2.4.3",
        "cors": "^2.8.5",
        "dotenv": "^16.4.5",
        "express": "^4.18.3",
        "jsonwebtoken": "^9.0.2",
        "knex": "^3.1.0",
        "mysql2": "^3.9.2",
        "yup": "^1.4.0"
    },
    "devDependencies": {
        "@types/bcryptjs": "^2.4.6",
        "@types/cors": "^2.8.17",
        "@types/express": "^4.17.21",
        "@types/jest": "^29.5.12",
        "@types/jsonwebtoken": "^9.0.6",
        "@types/supertest": "^6.0.2",
        "@typescript-eslint/eslint-plugin": "^7.2.0",
        "@typescript-eslint/parser": "^7.2.0",
        "eslint": "^8.57.0",
        "eslint-config-prettier": "^9.1.0",
        "jest": "^29.7.0",
        "prettier": "3.2.5",
        "sqlite3": "^5.1.7",
        "supertest": "^6.3.4",
        "ts-jest": "^29.1.2",
        "ts-node-dev": "^2.0.0",
        "typescript": "^5.4.2"
    }
}

Here are the commands I executed:

npm install $$ npm run build

I’d appreciate any insights on resolving this issue.

Hi there,

If you have NODE_ENV set to production, npm install will only install your dependencies not devDependencies. Without having Typescript installed, I believe npx tsc will try to use this, which is deprecated. I’m not sure if the warning is built into npx or tsc but either way, you don’t want to be using this tsc.

Move the typescript module to dependencies.

Regards,

Keith
Render Support, UTC+10 :australia:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.