2017-07-15 112 views
0

我一直在使用須藤NPM安裝-g打字稿,這似乎是工作裝打字稿因爲TSC -version返回版本2.2.2。我也嘗試在本地安裝它,因爲這個stackoverflow post建議。我相信我已經正確安裝了所有其他東西,因爲IDE可以正確打開其他文件。加載打字稿文件Webclipse錯誤

我的操作系統是Ubuntu 16.0。

錯誤消息:

java.lang.IllegalStateException: Node.js could not be found. If it is installed to a location not on the PATH, please specify the location in the TypeScript preferences. 

的tsconfig.json如下。我相信價值typeRoots應該指向@types的位置。確實與.json文件所在的目錄相同,有一個node_modules/@ types目錄,我認爲這應該啓用打字稿。

{ 
    "compileOnSave": false, 
    "compilerOptions": { 
    "outDir": "./dist/out-tsc", 
    "sourceMap": true, 
    "declaration": false, 
    "moduleResolution": "node", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "target": "es5", 
    "typeRoots": [ 
     "node_modules/@types" 
    ], 
    "lib": [ 
     "es2016", 
     "dom" 
    ] 
    } 
} 

回答

0

錯誤消息中提到的TypeScript首選項在Webclipse首選項中。 只需在shell中輸入which node返回的路徑即可。

Screen shot of configuration