[SOLVED] Ionic serve: ctorParameters.map is not a function


#1

Hi everyone,

When I run ionic serve on Windows Command Prompt the Google chrome developer console throws the following error:

Uncaught TypeError: ctorParameters.map is not a function
    at ReflectionCapabilities.parameters (\<project dir>\node_modules\@angular\core\src\reflection\reflection_capabilities.js:61:45)
    at Reflector.parameters (\<project dir>\node_modules\@angular\core\src\reflection\reflector.js:29:44)
    at CompileMetadataResolver.getDependenciesMetadata (\<project dir>\node_modules\@angular\compiler\src\metadata_resolver.js:449:54)
    at CompileMetadataResolver.getTypeMetadata (\<project dir>\node_modules\@angular\compiler\src\metadata_resolver.js:414:26)
    at eval (\<project dir>\node_modules\@angular\compiler\src\metadata_resolver.js:557:41)
    at Array.forEach (native)
    at CompileMetadataResolver.getProvidersMetadata (\<project dir>\node_modules\@angular\compiler\src\metadata_resolver.js:537:19)
    at eval (\<project dir>\node_modules\@angular\compiler\src\metadata_resolver.js:235:71)
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (\<project dir>\node_modules\@angular\compiler\src\metadata_resolver.js:226:44)

I tried to remove the node_modules directory and ran the command npm install to reinstall all the modules, but the problem persists.

The information of my ionic istallation are the following:

Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed

Someone could help me?

Thanks in advance.


#2

It would probably be useful to see the providers stanza of your app module.


#3

This is my AppModule class:

@NgModule({
  declarations: [
    MyApp,
    AboutPage,
    ContactPage,
    StartPage,
    LoginPage,
    ProductListsPage,
    SettingsPage,
    ProductsPage,
    RegistrationPage,
    SettingsPage,
    //components
    LinkedAccountRequest,
    LinkedAccountList,
    ShareProductListPage
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    BrowserModule,
    HttpModule,
    TranslateModule.forRoot({ 
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [Http]
    })
  ],
  exports: [
    BrowserModule, 
    HttpModule, 
    TranslateModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    AboutPage,
    ContactPage,
    StartPage,
    LoginPage,
    ProductListsPage,
    SettingsPage,
    ProductsPage,
    RegistrationPage
  ],
  providers: [
    TranslateService,
    AlertService, 
    LoadingService, 
    Net,
    ProductsService,
    ProductListsService,
    SettingsService,
    UserService,
    LinkedAccountService,
    SheetService,
    ModalService,
    NavigationService
  ]
})
export class AppModule {}

#4

I don’t know if this is it. I use .map when I use Observable.
and then I import this:

import 'rxjs/add/operator/map';


#5

I updated @angular/* package to 2.4.1 and now this error is solved.

Now a new error is thrown. (I think that is better report this new error in a new topic)

So… Could be the version of Angular 2 the problem?


#6

At the moment I think you have better follow this to upgrade to rc.4

https://github.com/driftyco/ionic/blob/master/CHANGELOG.md


#7

Ok, using this update guide the problem is solved.

Thanks.


#8

No thanks :slight_smile: