2017-06-27 57 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安裝打印機並且路徑位於環境變量中,請先將其刪除。然後重新啓動並重試。

我有像你一樣的問題,我通過上述步驟解決了它。

相關問題