Typescript command “tsc” undefined. Tried every kn

2019-03-06 12:47发布

Welcome, I can't run Typescript all my day. I use Visual Studio Code. What I am doing is installing TS globally:

$ npm install -g typescript

Then when I check it:

$ tsc

I get that error in all cases:

bash: tsc: command not found

To that time I have tried following solutions:

  1. Setting npm config:

$ npm config set prefix /usr/local

What I get after npm root -g is:

C:\Program Files\Git\usr\local\node_modules

  1. Setting npm config by relative way to get (And I get it):

    C:\usr\local\node_modules

  2. Setting .bash_profile:

export PATH=/usr/local/share/npm/bin:$PATH

  1. Setting .bashrc with PATH also...

  2. Installing Typecript as dev dependency also don't work.

  3. Other small solutions that I even don't remember.

Please for help. I can provide more information that you need - just say what.

1条回答
够拽才男人
2楼-- · 2019-03-06 13:00

Tried every known solution

Will definitely work:

  • Uninstall nodejs
  • Install nodejs (make sure you ask it to set PATH for you)
  • npm install typescript -g

查看更多
登录 后发表回答