Karma Angular - Cannot Find Name 'X'

左心房为你撑大大i 提交于 2019-12-25 08:51:42

问题


I'm getting a load of errors when I run Karma Start in my angular project.

All the errors say: 'Cannot find name Blob', 'Cannot Find name KeyboardEvent', 'Cannot find name HTMLElement', etc.

my tsconfig.json:

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

Help!


回答1:


adding "dom" to lib in tsconfig.app.json fixed it



来源:https://stackoverflow.com/questions/46836611/karma-angular-cannot-find-name-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!