Artimal
Artimal

Reputation: 661

Typescript command "tsc" undefined. Tried every known solution

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.

Upvotes: 0

Views: 693

Answers (1)

basarat
basarat

Reputation: 276303

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

🎊🌹

Upvotes: 1

Related Questions