It took me a while to figure out the solution to this problem - it's in the original question. You need to have a script that calls tsc in your package.json file so that you can run:

npm run tsc 

Include -- before you pass in options (or just include them in the script):

npm run tsc -- -v

Here's an example package.json:

{
  "name": "foo",
  "scripts": {
    "tsc": "tsc"
  },
  "dependencies": {
    "typescript": "^1.8.10"
  }
}
Answer from ubershmekel on Stack Overflow

It took me a while to figure out the solution to this problem - it's in the original question. You need to have a script that calls tsc in your package.json file so that you can run:

npm run tsc 

Include -- before you pass in options (or just include them in the script):

npm run tsc -- -v

Here's an example package.json:

{
  "name": "foo",
  "scripts": {
    "tsc": "tsc"
  },
  "dependencies": {
    "typescript": "^1.8.10"
  }
}
Answer from ubershmekel on Stack Overflow
🌐
daily.dev
daily.dev › home › blog › get into tech › npm tsc and typescript projects
Npm tsc and TypeScript Projects
February 4, 2025 - Creating a Project: Initialize with npm init, then configure TypeScript with tsconfig.json. Compilation: Use npm scripts to compile your TypeScript files with npm run compile.
Discussions

This is not the tsc command you are looking for
Just updated from typescript 4.3.1 to typescript 4.3.5. When I try to compile using npx tsc or npm run build, I got this: This is not the tsc command you are looking for To get access to the TypeSc... More on github.com
🌐 github.com
9
July 1, 2021
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 v… More on community.render.com
🌐 community.render.com
0
March 28, 2024
How to run tsc during npx
I figured out the answer, it looks like npx will run install command before running the script, so I can just add tsc to the preinstall script: "scripts": { "start": "node bin/tutorial.js", "build": "tsc", "prestart": "npm run build", "preinstall": "npm run build" } More on reddit.com
🌐 r/typescript
4
3
January 26, 2024
Is there a way to run TSC to do type-checking only for a single file?
By running tsc --help, you can see all of the help documentation for the tsc CLI. The second line of the help documentation says: tsc app.ts util.ts Ignoring tsconfig.json, compiles the specified files with default compiler options. There is also further information in TypeScript's online documentation for CLI Options . Note that this option ignores tsconfig.json. If that's not what you want, I also found a StackOverflow answer by searching "typescript run for specific files" on DuckDuckGo that seems to be your exact scenario. More on reddit.com
🌐 r/typescript
15
12
February 25, 2022
🌐
Reddit
reddit.com › r/typescript › how to run tsc during npx
r/typescript on Reddit: How to run tsc during npx
January 26, 2024 -

I'm learning typescript and I'm trying to create a script that will execute js files created by tsc. This is my package.json:

{
  "bin": "bin/tutorial.js",
  "scripts": {
    "start": "node bin/tutorial.js",
    "prestart": "npm run build",
    "build": "tsc"
  }

bin/tutorial.js is just a custom js file that I wrote that will execute the compiled js files in lib (tsconfig has outDir set to lib):

#!/usr/bin/env node
require('../lib/tutorial');

I am able to run the script using npm start, since it will build beforehand. However if I clean the lib directory and do 'npx .' then the tsc build will never happen. This means that the lib directory will be empty and my bin/tutorial.js file won't be able to import the compiled js.

How do I ensure that my scripts executed with npx can run the build step beforehand?

🌐
TypeScript
typescriptlang.org › download
TypeScript: How to set up TypeScript
You can use npm to install TypeScript globally, this means that you can use the tsc command anywhere in your terminal. To do this, run npm install -g typescript.
🌐
Visual Studio Code
code.visualstudio.com › docs › typescript › typescript-compiling
Compiling TypeScript
November 3, 2021 - Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler, tsc. You will need to install the TypeScript compiler either globally or in your workspace to transpile TypeScript source code to JavaScript (tsc HelloWorld.ts). The easiest way to install TypeScript is through npm, the Node.js Package Manager.
🌐
Microsoft Learn
learn.microsoft.com › en-us › visualstudio › javascript › compile-typescript-code-npm
Compile and build TypeScript code using npm - Visual Studio (Windows) | Microsoft Learn
June 24, 2025 - Add TypeScript support to your Visual Studio projects by using the Node Package Manager (npm) package for portability across different platforms and environments.
Find elsewhere
🌐
Node.js
nodejs.org › en › learn › typescript › run
Node.js — Running TypeScript with a runner
It allows you to run TypeScript code directly in Node.js without the need to compile it first. Note, however, that it does not type check your code. So we recommend to type check your code first with tsc and then run it with tsx before shipping it. To use tsx, you need to install it first: npm i -D tsx ·
🌐
RunJS
runjs.app › blog › how-to-run-typescript-file
How to Run TypeScript: A Step-by-Step Guide
November 26, 2024 - ... For larger projects, integrating TypeScript with build tools like Webpack or Babel can streamline your workflow. npm install --save-dev webpack webpack-cli ts-loader typescript ...
🌐
Simon Willison
til.simonwillison.net › typescript › basic-tsc
Very basic tsc usage | Simon Willison’s TILs
Apparently I need a tsconfig.json file. Running this command creates one for me containing some suggested defaults: ... Next step: create a .ts file to start testing it out. I put the following in greetings.ts: const greeting = (person: string) => { console.log("Hello " + person); }; greeting("Simon"); Next, compile it! Thanks to npm install --save-dev typescript the tsc compiler is now available here:
🌐
npm
npmjs.com › package › tsx
tsx - npm
2 weeks ago - TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files. Latest version: 4.21.0, last published: 13 days ago. Start using tsx in your project by running `npm i tsx`. There are 1890 other projects in the npm registry ...
      » npm install tsx
    
Published   Nov 30, 2025
Version   4.21.0
Author   Hiroki Osame
Homepage   https://tsx.is
🌐
npm
npmjs.com › package › typescript
typescript - npm
September 30, 2025 - Latest version: 5.9.3, last published: 2 months ago. Start using typescript in your project by running `npm i typescript`. There are 61825 other projects in the npm registry using typescript.
      » npm install typescript
    
Published   Sep 30, 2025
Version   5.9.3
Author   Microsoft Corp.
🌐
npm
npmjs.com › ts-node
ts-node
Latest version: 10.9.2, last published: 2 years ago. Start using ts-node in your project by running `npm i ts-node`. There are 15258 other projects in the npm registry using ts-node.
      » npm install ts-node
    
Published   Dec 08, 2023
Version   10.9.2
Author   Blake Embrey
🌐
Learn TypeScript
learntypescript.dev › 11 › l1-installing-running-compiler
Installing and running the compiler | Learn TypeScript
In the Terminal window, run the following command: ... This command first downloads and installs the typescript npm package. tsc is the executable name of the TypeScript compiler.
🌐
DigitalOcean
digitalocean.com › community › tutorials › typescript-running-typescript-ts-node
How To Run TypeScript Scripts with ts-node | DigitalOcean
March 23, 2022 - Using Node to run TypeScript scripts returns an error. Now that you know what not to do and what to expect when you do it. This is where ts-node comes in. ... If you would like to know more about the npx command, it’s a tool that now comes with npm that allows you to run binaries that are local to the project from the command line.
🌐
GitHub
github.com › microsoft › TypeScript › issues › 44843
This is not the tsc command you are looking for · Issue #44843 · microsoft/TypeScript
July 1, 2021 - { "name": "some-package", "version": "1.0.0", "description": "", "main": "build/index.js", "scripts": { "clean": "rm -fr build", "build": "npm run clean && tsc" }, "author": "xyz", "license": "ISC", "devDependencies": { }, "dependencies": { "typescript": "^4.3.5" }, }
Published   Jul 01, 2021
🌐
DigitalOcean
digitalocean.com › community › tutorials › setting-up-a-node-project-with-typescript
How To Set Up a Node Project With Typescript | DigitalOcean
October 21, 2024 - Run the linter to check all files with the .ts TypeScript extension: ... You’ve now set up the eslint linter to check your TypeScript syntax. Next, you’ll update your npm configuration to add some convenient scripts for linting and running your project.
🌐
Render
community.render.com › t › typescript-this-is-not-the-tsc-command-you-are-looking-for › 20334
Typescript: This is not the tsc command you are looking for - Render
March 28, 2024 - 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'...
🌐
Node.js
nodejs.org › en › learn › typescript › introduction
Node.js — Introduction to TypeScript
The code part is regular JavaScript with additional TypeScript-specific syntax for type annotations. When TypeScript code is compiled, all the TypeScript-specific parts are removed, resulting in clean JavaScript that can run in any environment.