2017-10-11 48 views
1

在IntelliJ-Idea 2017.1.1中获取TypeScript错误IDE编译时出现Typescript初始化错误

我尝试启用JavaScript,NodeJS和TypeScript Compiler。

我已经尝试了一切,但没有得到解决,我可能会错过某处。

Error: Initialisation error (typescript). Cannot read property 'createHash of undefined

任何人都可以帮我解决吗?

enter image description here

enter image description here

的package.json

{ 
    "name": "TempPractice", 
    "version": "0.0.1", 
    "description": "First Angular App", 
    "license": "MIT", 
    "repository": { 
    "type": "git", 
    "url": "[email protected]:angularjs-de/angularjs-typescript-seed.git" 
    }, 
    "main": "app/app.ts", 
    "scripts": { 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "lite": "lite-server", 
    "typings": "typings", 
    "postinstall": "typings install", 
    "update-deps": "npm update", 
    "postupdate-deps": "bower update", 
    "prestart": "npm install", 
    "start": "http-server -a localhost -p 8000 -c-1 ./app", 
    "pretest": "npm install", 
    "test": "karma start karma.conf.js", 
    "test-single-run": "karma start karma.conf.js --single-run", 
    "preupdate-webdriver": "npm install", 
    "update-webdriver": "webdriver-manager update", 
    "preprotractor": "npm run update-webdriver", 
    "protractor": "protractor e2e-tests/protractor.conf.js", 
    "update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/bower_components/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').split(/sourceMappingURL=angular-loader.min.js.map/).join('sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').split(/\\/\\/@@[email protected]@[\\s\\S]*\\/\\/@@[email protected]@/).join('//@@[email protected]@\\n'+loaderText+' //@@[email protected]@');fs.writeFileSync(indexFile,indexText);\"" 
    }, 
    "dependencies": { 
    "@angular/common": "^4.4.4", 
    "@angular/compiler": "^4.4.4", 
    "@angular/core": "^4.4.4", 
    "@angular/forms": "^4.4.4", 
    "@angular/http": "^4.4.4", 
    "@angular/platform-browser": "^4.4.4", 
    "@angular/platform-browser-dynamic": "^4.4.4", 
    "@angular/router": "^4.4.4", 
    "angular-in-memory-web-api": "^0.5.0", 
    "angular-route": "^1.6.6", 
    "bootstrap": "^3.3.7", 
    "font-awesome": "^4.7.0", 
    "rxjs": "^5.4.3", 
    "ts-node": "^3.3.0", 
    "typescript": "^2.5.3", 
    "typings": "^2.1.1", 
    "zone.js": "^0.8.18" 
    } 
} 

tsconfig.json

{ 
    "compilerOptions": { 
     "module": "system", 
     "removeComments": true, 
     "preserveConstEnums": true, 
     "experimentalDecorators": true, 
     "emitDecoratorMetadata": true, 
     "sourceMap": true, 
     "inlineSources": true, 
     "target": "es5" 

    }, 
    "compileOnSave": false, 
    // Points folders and file to exclude 
    "exclude": [ 
     "node_modules", 
     "typings/main", 
     "typings/main.d.ts" 
    ] 
    } 

typings.json

{ 
    "ambientDependencies": { 
     "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd", 
     "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd" 
    } 
    } 
+0

'InitialiSation error'这似乎不是一个真正的错误。你究竟在何时何地观察到这个错误? –

+0

当我创建main.ts文件 –

+0

或任何TypeScript文件 –

回答

3

打字稿版本使用的是(2.5.3)不符合在2017年1月1日提供打字稿服务集成兼容。该问题是由于服务API发生重大更改而导致的(https://github.com/Microsoft/TypeScript/issues/15433)。

WEB-26641固定在2017.1.3,所以它可以兼容所有TypeScript版本到2.4。 但是2.5.x添加了更多的重大更改。因此,如果您需要使用TypeScript 2.5.3的IDEA,请务必更新到最新的IDEA版本。