2017-07-05 57 views
-1
throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset)) 
    ^
TSError: ⨯ Unable to compile TypeScript 
Cannot find type definition file for 'jasmine'. (2688) 
Cannot find type definition file for 'node'. (2688) 

api/public/reports/api-report.spec.ts (1,46): Cannot find module './api-report'. (2307) 
... 
20 lines of different modules not found 
src/api/public/reports/api-report.spec.ts (134,17): Cannot find name 'expect'. (2304) 

^以上錯誤看了很多,重新安裝了node,npm,nvm,jasmine。看着我的代碼。不知道它可能是什麼。不能編譯打字稿Ubuntu的

+0

它可能會導致你到一個更好的地方:)我發現使用[打字稿一起使用webpack](https://www.typescriptlang.org/docs/handbook/integrating-with-build-tools.html# webpack)一個更愉快的體驗:) 編輯: 你確實需要爲你的依賴做'npm i -D @ types/[module]' –

回答

0

由於找不到節點的類型定義,因此我只能假定您正在使用節點應用程序,並且沒有安裝類型定義。你需要:

npm install @types/node --save-dev 

...,然後引用該文件用三斜線指令。

請參閱關於type definitionsreferences的文檔。聽起來你也需要爲茉莉花做這個。

這聽起來像你可能沒有適當地導入其他模塊,但是如果沒有看到代碼就不可能分辨出來。