tsc is not recognized as an internal or external command

后端 未结 3 1265
生来不讨喜
生来不讨喜 2021-01-21 08:40

I am using node version 6.9.2 with npm version 5.4.2 on Windows7. I have installed typescript with the command npm install typescript -g.

However, when I r

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 09:12

    The problem is likely that tsc is not in the system path.

    First, check if tsc is installed correctly. Open cmd.exe and type the following.

    %AppData%\npm\node_modules\typescript\bin\tsc --version
    

    If there is a version log, then tsc is installed successfully.

    The next thing is to add it in PATH. Write in cmd.exe

    setx path "%path%;%AppData%\npm\node_modules\.bin\"
    

    This should solve the issue.

    However, if the first command did not log the version,

    Check the install location using

    npm list -g
    

    If typescript appears in the output, copy the location to the PATH as

    setx path "%path%;<--the tsc.exe path-->"
    

    Hope this helps.

提交回复
热议问题