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.
🌐
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.
🌐
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?

🌐
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.
🌐
npm
npmjs.com › package › tsc-watch
tsc-watch - npm
The TypeScript compiler with onSuccess command. Latest version: 7.2.0, last published: 2 months ago. Start using tsc-watch in your project by running `npm i tsc-watch`. There are 240 other projects in the npm registry using tsc-watch.
      » npm install tsc-watch
    
Published   Sep 28, 2025
Version   7.2.0
Author   Gil Amran
🌐
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
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
🌐
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.
🌐
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 › tsc-init
tsc-init - npm
A command to initialize TypeScript and Webpack. Latest version: 2.1.0, last published: 8 years ago. Start using tsc-init in your project by running `npm i tsc-init`. There are 40 other projects in the npm registry using tsc-init.
      » npm install tsc-init
    
Published   Nov 16, 2017
Version   2.1.0
Author   Yiyi Sun
🌐
Carl Rippon
carlrippon.com › installing-and-running-the-typescript-compiler
Installing and Running the TypeScript Compiler | Building SPAs
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.
🌐
Edureka Community
edureka.co › home › community › categories › typesript › how to install and run typescript locally in npm
How to install and run Typescript locally in npm | Edureka Community
June 7, 2022 - I want to install and run Typescript (i.e. no global dependencies). Here is my package. ... the local packages again, it reintroduces the problem.
🌐
npm
npmjs.com › package › tsc-files
tsc-files - npm
Latest version: 1.1.4, last published: 2 years ago. Start using tsc-files in your project by running `npm i tsc-files`. There are 12 other projects in the npm registry using tsc-files.
      » npm install tsc-files
    
Published   Jul 04, 2023
Version   1.1.4
Author   Gustavo P. Cardoso
🌐
npm
npmjs.com › ts-node
ts-node - npm
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
🌐
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
🌐
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'...