I am a beginner with type script. I am unable to compile the type script file.
As I hit Ctrl+Shift+B in the VS Code, i get the error "tsc is not recognised"
I used npm while downloading transcript.
C:\Users\sramesh>npm install -g typescript
C:\Users\sramesh\AppData\Roaming\npm\tsserver -> C:\Users\sramesh\AppData\Roaming\npm\node_modules\typescript\bin\tsserver
C:\Users\sramesh\AppData\Roaming\npm\tsc -> C:\Users\sramesh\AppData\Roaming\npm\node_modules\typescript\bin\tsc
C:\Users\sramesh\AppData\Roaming\npm
`-- [email protected]
Here is my tasks.json file
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "C:\\Users\\sramesh\\AppData\\Roaming\\npm\\node_modules\\typescript\\bin\\tsc",
"isShellCommand": true,
"args": [],
"showOutput": "silent",
"problemMatcher": "$tsc"
}
Can anyone help?
I'm using Windows OS and For some reason the marked answer didn't work for me.I tried tsc--init
and i was returned the same error.I updated the path variable to C:\Users\"UserName"\AppData\Roaming\npm
and this worked..
Note:replace Username with your own Username
I had a similar issue and didn't even showed the version of Typescript after typing tsc -v. Even i had to scratch my head for few days and couldn't solve it.
At last i did 4 things.
Now, I can see the TS version, and also compile the TS code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With