2017-06-27 1240 views
0

在新计算机上设置项目并遇到Typescript版本控制问题。我曾尝试:Typescript安装/版本错误:术语'tsc'未被识别

npm install -g typescript 
npm install typescript 
npm install -g [email protected] 
npm install -g [email protected] 

但每次我尝试使用检查版本:

tsc -v 

我收到以下错误:

The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path wa 
s included, verify that the path is correct and try again. 
At line:1 char:4 
+ tsc <<<< -v 
    + CategoryInfo   : ObjectNotFound: (tsc:String) [], CommandNotFoundException 
    + FullyQualifiedErrorId : CommandNotFoundException 

作为参考,包括的package.json :

"scripts": { 
    "postinstall": "typings install", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "typings": "typings", 
    "gulp": "gulp", 
    "build-dev": "gulp", 
    }, 
"devDependencies": { 
    "gulp": "^3.9.1", 
    "gulp-concat": "^2.6.0", 
    "gulp-inline-ng2-template": "^4.0.0", 
    "gulp-typescript": "^3.0.2", 
    "path": "^0.12.7", 
    "systemjs-builder": "^0.15.26", 
    "typescript": "^2.1.6", 
    "typings": "^2.0.0" 
    } 

当我ru ñTSC -v我的机器上(这是工作)我得到

Version 2.0.10 

憋屈什么,我需要做的安装打字稿,使得TSC命令被认可?

回答

0

如果此问题来自您的命令外壳程序。 首先安装最新的npm版本,然后再次尝试安装打字稿。

如果您在运行tsc build任务时在VS代码终端中使用VS CODE进行开发和问题:如果您从Visual Studio 2015/2017安装打印机并且路径位于环境变量中,请先将其删除。然后重新启动并重试。

我有像你一样的问题,我通过上述步骤解决了它。

相关问题