I want to install typescript, so I used the following command:
npm install -g typescript
and test tsc --version
, but it just
I do not have admin privileges since this machine was issued by my job.
npm config get prefix | clip
npm config get prefix
rundll32 sysdm.cpl,EditEnvironmentVariables
This works perfectly on Mac. Tested on macOS High Sierra
sudo npm install -g concurrently
sudo npm install -g lite-server
sudo npm install -g typescript
tsc --init
This generates the tsconfig.json file.
A few tips in order
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).
If your TSC command is not found in MacOS after proper installation of TypeScript (using the following command: $ sudo npm install -g typescript
, then ensure Node /bin
path is added to the PATH
variable in .bash_profile
.
Open .bash_profile
using terminal: $ open ~/.bash_profile;
Edit/Verify bash profile to include the following line (using your favorite text editor):
export PATH="$PATH:"/usr/local/lib/node_modules/node/bin"";
Load the latest bash profile using terminal: source ~/.bash_profile
;
Lastly, try the command: $ tsc --version
.
For windows:
Add the path by using command as below in command prompt:
path=%path%;C:\Users\\npm
As in my case, the above path was not registered for command.
%userprofile% in run windows, will give you path to C:\users\
I had to do this:
npx tsc app.ts