Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error TS2688 Build:Cannot find type definition file for 'mocha' after TypeScript update

I, am keep getting the error: Cannot find type definition file for 'mocha' when I update the TypeScript to latest version.

tsconfig.json

    {
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es2015", "dom" ],
    "module": "commonjs",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "sourceMap": true,
    "suppressImplicitAnyIndexErrors": true,
    "target": "es5",
    "rootDir": "app",
    "outDir": "wwwroot/app"
  },
  "exclude": [
    "node_modules",
    "wwwroot/node_modules",
    "typings"

  ]
}

I, have not change any things. It was working perfectly earlier just I update the TypeScript version from 2.2.2 to 2.5 and keep getting error. I, am using Angular 4

Package.json

    {
  "version": "1.0.0",
  "name": "asp.net",
  "private": true,
  "dependencies": {
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/platform-server": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@angular/upgrade": "2.0.0",
    "angular2-in-memory-web-api": "0.0.20",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.9",
    "rxjs": "5.0.2",
    "systemjs": "0.19.27",
    "typescript": "^2.4.1",
    "zone.js": "0.7.6"
  },
  "devDependencies": {}
}
like image 881
San Jaisy Avatar asked Sep 10 '17 03:09

San Jaisy


2 Answers

You need to install type definitions for mocha:

npm install @types/mocha
like image 170
basarat Avatar answered Nov 10 '22 00:11

basarat


This is an issue on @nestjs/microservice and it is fixed on upgrading it to 6.5.1 Please check the issue here

like image 42
Mohamed Saleh Avatar answered Nov 10 '22 01:11

Mohamed Saleh