StackOverflower StackOverflower - 4 months ago 10
AngularJS Question

Why is no angular module found?

In my angulsr2 project under visual studio, I'm not able to compile typescript files after migrating angular2 from beta to rc.

I'm getting


Build:Cannot find module '@angular2/platform/browser'.

Build:Cannot find module '@angular2/router'.

Build:Cannot find module '@angular2/http'.

etc...


Project Tree

Project Tree

Errors

Errors

tsconfig.json

{
"compilerOptions": {
"sourceRoot": "/app/ts",
"module": "system",
"outDir": "./wwwroot/app/js",
"target": "es6",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"compileOnSave": true,
"exclude": [
"node_modules",
"typings"
]
}


** packages.json**

{
"version": "1.0.0",
"name": "AngularTest",
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",

"systemjs": "0.19.27",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"es6-promise": "^3.0.2",
"bootstrap": "^3.3.5",
"jquery": "2.1.4",
},
"devDependencies": {
"gulp": "^3.9.1",
"del": "2.1.0"
}
}


I'm not certain what's missed, I'm comparing against other project and I seem to have the same but something is obviously different

Answer

There is no @angular2. It's either @angular or for older versions angular2. You need to fix your imports.

... from '@angular/platform/browser'.
... from '@angular/router'.
... from '@angular/http'.