Build: Cannot find type definition file for "mocha" in tsc file after upgrade to angular 4

I upgrade the current version of the project to Angular 4. And I get an error like Build:Cannot Find type definition file for 'mocha' in tsc file

I updated the project by following these steps.

  • npm install @ angular / common @latest @ angular / compiler @latest @ angular / compiler-cli @latest @ angular / core @latest @ angular / forms @latest @ angular / http @latest @ angular / platform-browser @latest @angular / platform-browser-dynamic @latest @ angular / platform-server @latest @ angular / router @latest @ angular / animations @latest typescript @latest --save

  • updated stypescript version to version 2.3.1

I am using the Visual Studio 2015 Update.

This is my package.json file

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings",
    "build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup-config.js"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "https://github.com/angular/angular.io/blob/master/LICENSE"
    }
  ],
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@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": "~4.1.1",
    "angular-in-memory-web-api": "~0.3.2",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "mocha": "^3.1.2",
    "reflect-metadata": "^0.1.8",
    "rxjs": "^5.0.1",
    "systemjs": "0.20.12",
    "typescript": "^2.3.1",
    "typings": "^1.5.0",
    "zone.js": "^0.8.10"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^4.0.0",
    "concurrently": "^3.0.0",
    "lite-server": "^2.2.2",
    "rollup": "^0.41.4",
    "rollup-plugin-commonjs": "^8.0.2",
    "rollup-plugin-node-resolve": "^3.0.0",
    "rollup-plugin-uglify": "^1.0.1",
    "typescript": "^2.2.0-dev.20170207",
    "typings": "^2.1.1"
  }
}
+4
source share
1 answer

, , Visual Studio typescript , npm. , , , : http://rostacik.net/2015/08/14/how-to-disable-building-of-typescript-files-in-visual-studio-2015/

: node

<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>

<PropertyGroup>

.csproj.

0

Source: https://habr.com/ru/post/1676819/


All Articles