'tsc command not found' in compiling typescript

后端 未结 15 950
耶瑟儿~
耶瑟儿~ 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:22

    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.

提交回复
热议问题