I want to install typescript, so I used the following command:
npm install -g typescript
and test tsc --version, but it just
tsc --version
I solved this on my machine by just running sudo npm install in the directory that I was getting the error.
sudo npm install