2017-07-07 11 views
3

をコンパイルすることができませんが:エラー:TSError:⨯私は問題に直面しています活字体

私のプロジェクトはtypescriptです、分度器&カルマとE2EテストでAngular4上に構築されています。

トラヴィス-ciが、このエラーが発生しました:

[03:34:54] E/launcher - Error: TSError: ⨯ Unable to compile TypeScript 
Cannot find type definition file for 'jasmine'. (2688) 
Cannot find type definition file for 'node'. (2688) 
e2e/app.e2e-spec.ts (1,32): Cannot find module './app.po'. (2307) 
e2e/app.e2e-spec.ts (4,1): Cannot find name 'describe'. (2304) 
e2e/app.e2e-spec.ts (7,3): Cannot find name 'beforeEach'. (2304) 
e2e/app.e2e-spec.ts (11,3): Cannot find name 'it'. (2304) 
e2e/app.e2e-spec.ts (13,5): Cannot find name 'expect'. (2304) 

The command "ng e2e" exited with 4. 

マイtsconfig.json:

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

マイtsconfig.spec.json:

{ 
    "compilerOptions": { 
    "sourceMap": true, 
    "declaration": false, 
    "moduleResolution": "node", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "lib": [ 
     "es2016", 
     "dom" 
    ], 
    "outDir": "../out-tsc/spec", 
    "module": "commonjs", 
    "target": "es5", 
    "baseUrl": "", 
    "types": [ 
     "jasmine", 
     "node" 
    ], 
    "typeRoots": [ 
     "../node_modules/@types" 
    ] 
    }, 
    "files": [ 
    "test.ts" 
    ], 
    "include": [ 
    "**/*.spec.ts" 
    ] 
} 

ノードv6.10.3

npm v3.10.10

私を助けてください。

+0

[こちら](https://github.com/AngularClass/angular-starter/issues/615)の回避策を参照してください。これらが同じであるかどうかは分かりません。乾杯! – demouser123

+0

私のdevDependenciesを更新し、このエラーを修正しました! – RicoLiu

答えて

2

私は同じ問題を抱えていました。まず、package.jsonからts-nodeとtypescriptを削除します。

npm install ts-node --save-de 
npm install -g typescript --save-dev 
関連する問題