khalil _diouri
khalil _diouri

Reputation: 821

angular2 rc5 Error loading http://localhost:3000/node_modules/@angular/forms.js

I want to migrate from angular2 rc4 to rc5

and I'm not able to lanch my project

boot.ts

'use strict';
import { browserDynamicPlatform } from '@angular/platform-browser-dynamic';
import {AppModule} from "./AppModule";



browserDynamicPlatform().bootstrapModule(AppModule)
.catch(err => console.error(err));

this is my AppModule.ts

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        routing
    ],
    declarations: [
        AppComponent,
        loginComponent
       // CrisisListComponent
    ],
    providers: [
        appRoutingProviders
    ],
    bootstrap: [ AppComponent ]
})
export class AppModule {
}

and my appRouting

const appRoutes: Routes = [
    {path: '', component: loginComponent},
    {path: 'login', component: loginComponent},

];

export const appRoutingProviders: any[] = [
   ]

export const routing = RouterModule.forRoot(appRoutes);

and I getting this error

enter image description here

Upvotes: 1

Views: 471

Answers (1)

Alex Beugnet
Alex Beugnet

Reputation: 4071

I should comment first to ask my question, but I don't have enough reputation so I'll ask them here in my answer :

  • Did your forms work in RC4 before upgrading to RC5 ?
  • Did you make sure you upgraded all the packages to RC5 ?
  • Also, you should check your systemjs.config.js, the problem could be coming from there as well.

I think it's coming from your "@angular/forms": "0.3.0" package, which is not up to date, but I'm not sure and I need more information to be sure of it, but if that's the case, you should check this out :

My package.json file with the last versions is looking like that :

"dependencies": {
    "@angular/common": "2.0.0-rc.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.5",

    "angular2-in-memory-web-api": "0.0.15",

    "systemjs": "0.19.36",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.11",
    "zone.js": "^0.6.12"
  },

You can either manually update all the packages, or you can use a tool for that as well. I recommend using npm-check-updates : https://www.npmjs.com/package/npm-check-updates.

Typing ncu shows me what packages need to be updated, and ncu -u will get the latests versions for each package.

After that, if you did it correctly, and if you did configure the new Angular2 RC5 NgModules correctly, your app should work just like before.

Hope this helps.

Upvotes: 1

Related Questions