Runtime error "Can't resolve all parameters for "

Hello recently i update my project to ionic 2 rc4, the compilation is doing correctly but when my app start to load I get the next runtime error

Uncaught Error: Can't resolve all parameters for ActiveChat: (App, DataService, NgZone, TranslateService, ModalController, ?, Config). at CompileMetadataResolver._getDependenciesMetadata (file:///android_asset/www/build/main.js:33514:19) at CompileMetadataResolver._getTypeMetadata (file:///android_asset/www/build/main.js:33408:26) at file:///android_asset/www/build/main.js:33558:41 at Array.forEach (native) at CompileMetadataResolver._getProvidersMetadata (file:///android_asset/www/build/main.js:33538:19) at CompileMetadataResolver._loadNgModuleMetadata (file:///android_asset/www/build/main.js:33321:50) at CompileMetadataResolver.loadNgModuleMetadata (file:///android_asset/www/build/main.js:33204:29) at RuntimeCompiler._loadModules (file:///android_asset/www/build/main.js:49527:41) at RuntimeCompiler._compileModuleAndComponents (file:///android_asset/www/build/main.js:49497:35) at RuntimeCompiler.compileModuleAsync (file:///android_asset/www/build/main.js:49487:21)

I dont undertand because happen this error, but apparently the code for my service is correct, bellow i show the service constructor

`import {App, ModalController, Platform} from ‘ionic-angular’;
import {TranslateService} from ‘ng2-translate/ng2-translate’;
import {NgZone, Injectable} from ‘@angular/core’;

import {DataService} from ‘…/…/services/data’;
import {Session} from ‘…/…/services/session’;
import {ChatPage} from ‘./chatView’;
import {S3Images} from ‘…/…/services/s3images’;
import {EntityPage} from ‘…/entity/entity’;
import {SearchPage} from ‘…/search/search’;

import {Config} from ‘…/…/config’;

@Injectable()
export class Chats {
isIos :boolean
identifyAgents: any
items : any
itemsDefault:any;
fieldsNotPersist : any = {
‘ownerOnline’:true,
‘session’:true
}
loaded : boolean
bucketS3Entities: string
bucketS3Misc: string
itemsD : any
searchTimeout:any
hideQrMsg:boolean
edited: boolean
searchQuery:string
complete:boolean
searchPage: any
groupEntities: any

constructor(public dataService : DataService,
public app : App,
public zone : NgZone,
public translate : TranslateService,
public imagesService : S3Images,
public modalCtrl : ModalController,
public config : Config,
public platform : Platform) {
}`

and the import where i use the service ‘Chats’

`import {TranslateService} from ‘ng2-translate/ng2-translate’;
import {App, ModalController} from ‘ionic-angular’;
import {NgZone, Injectable} from ‘@angular/core’;

import {DataService} from ‘…/…/services/data’;
import {Config} from ‘…/…/config’;

import {ModalCall} from ‘./call’;
import {Chats} from ‘./chats’;

@Injectable()
export class ActiveChat{
hotel :any
time: any
page: any
msgs : any
newContact: boolean
foreground: boolean = false
constructor(public app : App,
public dataService : DataService,
public zone : NgZone,
public translate : TranslateService,
public modal : ModalController,
public chats : Chats,
public config : Config) {
}`

I hope you can help me please, thank you.

Regards

Make sure Chats is declared in the providers section of your app module (along with all its dependencies). I’m also nervous that you’re importing NgZone all over the place; that’s typically a hallmark of a cargo cult.

thank you for response, yes i have chats declared in providers, bellow show an example how i have my app.module.ts

import { NgModule } from ‘@angular/core’;
import { IonicApp, IonicModule } from ‘ionic-angular’;
import { MyApp } from ‘./app.component’;

import {HttpModule, Http} from ‘@angular/http’;
import {TranslateModule, TranslateLoader,TranslateStaticLoader,TranslateService} from ‘ng2-translate/ng2-translate’;

import {CustomIconsModule} from ‘ionic2-custom-icons’;

import {Chats} from ‘…/pages/chats/chats’;
import {ActiveChat} from ‘…/pages/chats/chat’

export function createTranslateLoader(http: Http){
return new TranslateStaticLoader(http, ‘./assets/i18n’, ‘.json’);
}

@NgModule({
declarations: [
/declarations/
],
imports: [
IonicModule.forRoot(MyApp, {backButtonText: ’ '}), CustomIconsModule,
HttpModule,

TranslateModule.forRoot({
      provide: TranslateLoader,
      useFactory: (createTranslateLoader),
      deps: [Http]
    })

],
exports: [HttpModule, TranslateModule],
bootstrap: [IonicApp],
entryComponents: [
/entryComponents/
],
providers: [
Chats,
ActiveChat
]
})
export class AppModule {}

with ionic 2 RC3 work correctly, thank you.
Regards

I’m confused. I thought Chats was a service, but it’s under your pages directory. providers is for services, not components. I also don’t see S3Images in there.

Yes, Chats is like a service but i need do a restructure of my project, for the moment i have the Chats class in the pages directory, but i don’t think that it have some relation with the issue described it or why with ionic 2 RC3 works correctly?, thank you.

Regards

Hello, apparently using the option “–aot” is fixed, when i do the build, thank you.
Regards

Can you explain what you did?

Hello, yes i just add the option --aot when i do the build, like this
ionic build --aot

Thanks. I managed to resolve this problem by deleting my entire node_modules folder, and running npm install again. There, it showed some dependencies that I missed, with angular and typescript. So I manually changed it in my package.json and did npm install again and everything good.