我不明白为什么我会一次又一次有这个错误...当我有一个新的提供商时。当我有其他提供商(例如Geolocation等)时,我会有此错误:
错误:未知的错误:ngmodule'appModule'的无效提供商 - 仅允许提供商和类型的实例,得到:[statusbar,splashscreen,?[对象对象]?,...]
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { ImagePicker } from '@ionic-native/image-picker';
import { Crop } from '@ionic-native/crop';
import { AuthService } from '../pages/core/auth.service';
import { UserService } from '../pages/core/user.service';
import { FollowService } from "../pages/core/follow.service";
import { AngularFireModule } from 'angularfire2';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { environment } from '../environment/environment';
import { MyApp } from './app.component';
import { LoginPage } from '../pages/login/login';
import { RegisterPage } from '../pages/register/register';
import { WelcomePage } from '../pages/welcome/welcome';
import { HomePage } from '../pages/home/home';
@NgModule({
declarations: [
MyApp,
LoginPage,
RegisterPage,
WelcomePage,
HomePage,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
AngularFireModule.initializeApp(environment.firebase),
AngularFireAuthModule,
AngularFireDatabaseModule,
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
LoginPage,
RegisterPage,
WelcomePage,
HomePage,
],
providers: [
StatusBar,
SplashScreen,
ImagePicker,
Crop,
AuthService,
UserService,
FollowService,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
尝试将/ngx
添加到Ionic 4:
import { File } from '@ionic-native/file/ngx';
听起来您正在使用Ionic 4支持带有Ionic 3 App的节点模块。例如,以 Geolocation
。
如果要在离子3应用程序中安装@ionic-native/geolocation
模块,则需要使用 @4
如下。
npm install @ionic-native/geolocation@4
您需要为所有Ionic3提供商做到这一点。