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)
Windows 10 - How do I install tsc? Or even npm for that matter? Typerscript is supposedly installed.
Typescript: This is not the tsc command you are looking for
node.js - How to install and run Typescript locally in npm? - Stack Overflow
How do I install typescript locally?
Videos
ยป npm install tsc
ยป npm install typescript
programming language, superset of JavaScript that compiles to JavaScript
Factsheet
Anders Hejlsberg,
Luke Hoban
Anders Hejlsberg,
Luke Hoban
Do I need Visual Studio? I only want to run transpile one project into js. What hoops must I jump through to do that? The instructions I've found assume I have something I don't. I used chocolatey to install typescript, which installed nodejs, but I don't have npm or npx, which are not installs provided by cholocatey. So where do I look next?
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"
}
}
As of npm 5.2.0 you no longer need an entry in the scripts section of package.json. You can now run the compiler with npx:
npx tsc
...and you don't have to update package.json with a new script every time you want to compile with different arguments.
I have been trying to install TypeScript but most resources only teach how to install it globally. Can anyone describe or give resources on how to install it on a windows machine locally?
Side-note: When I set I use npm install TypeScript --save-dev I find myself unable to use tsc- --v or
tsc --version