0

I have an Angular 2.4 + ASP.NET MVC Core project (targeting .NET 4.5). The project builds and works fine without any tsconfig.json file. When I add it the build fails with such errors in .ts files:

TS2307  Cannot find module '@angular/core'.

The tsconfig.json file:

{
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

I also tried "module": "system" or "module": "commonjs" also "moduleResolution": "node" settings but none of those didn't do any good. Project is using SystemJS.

What am I doing wrong?

dstr
  • 8,362
  • 12
  • 66
  • 106
  • 1
    http://stackoverflow.com/questions/37484442/angular2-cannot-find-module-angular-core add `"moduleResolution": "node"` – Suraj Rao Mar 01 '17 at 10:53
  • @suraj: I've already tried moduleResolution setting. Didn't work for me. – dstr Mar 01 '17 at 11:07
  • 1
    you also havent added `"lib": [ "es2015", "dom" ],` not sure if that is the problem. https://angular.io/docs/ts/latest/guide/typescript-configuration.html#!#tsconfig – Suraj Rao Mar 01 '17 at 11:14

0 Answers0