2017-07-05 247 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的文档。听起来你也需要为茉莉花做这个。

这听起来像你可能没有适当地导入其他模块,但是如果没有看到代码就不可能分辨出来。