tsc:无法将术语“tsc”识别为用于配置TypeScript程序的cmdlet、函数、脚本文件或可执行程序的名称

9jyewag0  于 2022-12-19  发布在  TypeScript
关注(0)|答案(2)|浏览(510)

配置TypeScript程序时出错。

tsc: The term 'tsc' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
ttvkxqim

ttvkxqim1#

Typescript可能由于某种原因而未全局安装,因此请执行此操作。

npm install -g typescript // install globally

如果您想将.ts文件转换为.js文件,请根据需要进行转换

tsc path/file.ts // file.ts will be converted to file.js
tsc              // all .ts files will be converted to .js files with in the directory
tsc --watch      // converts all .ts files to .js, and watch changes in .ts files
zvokhttg

zvokhttg2#

全局安装 typescript

npm install -g typescript

相关问题