'tsc command not found' in compiling typescript

后端 未结 15 949
耶瑟儿~
耶瑟儿~ 2020-12-05 02:02

I want to install typescript, so I used the following command:

npm install -g typescript 

and test tsc --version, but it just

15条回答
  •  粉色の甜心
    2020-12-05 02:10

    This answer is specific for iTermV2 on MAC

    1. First of all, I needed to instal as sudo (admin) during NPM install

      sudo npm install -g typescript

    2. NPM installs the libraries under /usr/local/Cellar/node//lib/node_modules/typescript folder and symlinks at /usr/local/Cellar/node//bin/tsc

    hence I went ~/.zshrc ( .bashrc, if you use bash)and added /usr/local/Cellar/node//bin to the $PATH.

    1. reload the shell profile via source ~/.zshrc (.bashrc in your case)

提交回复
热议问题