A few tips in order
- restart the terminal
- restart the machine
- reinstall nodejs + then run
npm install typescript -g
If it still doesn't work run npm config get prefix to see where npm install -g is putting files (append bin to the output) and make sure that they are in the path (the node js setup does this. Maybe you forgot to tick that option).
A few tips in order
- restart the terminal
- restart the machine
- reinstall nodejs + then run
npm install typescript -g
If it still doesn't work run npm config get prefix to see where npm install -g is putting files (append bin to the output) and make sure that they are in the path (the node js setup does this. Maybe you forgot to tick that option).
You are all messing with the global installations and -path files. Just a little error might damage every project you have ever written, and you will spend the rest of the night trying to get a console.log('hi') to work again.
If you have run npm i typescript --save-dev in your project - just try to run:
npx tsc
And see if it works before messing with global stuff (unless of course you really know what you are doing)
Is there a way to run TSC to do type-checking only for a single file?
TSC is not recognized as the etc, etc etc... It worked yesterday but doesn't today? I don't understand.
pnpx tsc failed with "This is not the tsc command you are looking for"
Any Point to Using tsc Command when Making an Angular Project?
Videos
To be clear, I still want to use my tsconfig.json configuration while I do this.
My reasoning is I started using Vite recently, and I've been blown away by its speed. Obviously one of the downsides of Vite is that it compiles TS code without type checking, so you need to run the type checking after the fact (tsc --noEmit).
My goal is to use TSC for type checking in a similar way to eslint. There is an excellent NPM package, lint-staged, which automatically passes in a comma-separated list of files that have changed to the eslint command. This allows for much more efficient linting of only changing files as a pre-commit hook.
My hope is to find some way to use the CLI options for TSC (or another tool, if one exists) that can perform this same functionality. That way I can enforce all my type-checking as a pre-commit hook and streamline my new Vite workflow.
Thanks so much in advance.
I was happily learning how to use typescript, and I go to build a new file today and I hit that error. I have installed typescript 4 times since, and it still won't recognize the tsc command anywhere. What on earth happened? I haven't done any programming since I closed it yesterday. So what's going on here?
» npm install typescript