运行时错误:找不到模块“ ./config”

时间:2019-06-15 14:58:26

标签: javascript node.js angular ionic3

嗨,大家好,我正在尝试在Ionic 3 App上进行更改,我已经降级了节点并运行了npm install,但是无论何时我运行离子服务,我都会在浏览器中始终收到此错误。 请帮助

Runtime Error: Cannot find module "./config"

Stack

Error: Cannot find module "./config"

at Object.<anonymous> (http://localhost:8100/build/main.js:95985:7)
at __webpack_require__ (http://localhost:8100/build/main.js:48:30)
at Object.<anonymous> (http://localhost:8100/build/main.js:139326:70)
at __webpack_require__ (http://localhost:8100/build/main.js:48:30)
at http://localhost:8100/build/main.js:140:18
at http://localhost:8100/build/main.js:143:10

App.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { FormsModule } from "@angular/forms";
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { IonicStorageModule } from '@ionic/storage';
import { HttpModule } from "@angular/http";

import { MyApp } from './app.component';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { StorageService } from "../providers/storage";
import { Auth } from "../providers/auth";
import { Api } from "../providers/api";
import { DatabaseService } from "../providers/database";

import { AngularFireModule } from "angularfire2";
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { firebaseConfig } from './config';
import { ValidateProvider } from '../providers/validate/validate';

@NgModule({
  declarations: [
    MyApp,
  ],
  imports: [
    BrowserModule,
    HttpModule,
    FormsModule,
    IonicStorageModule.forRoot(),
    AngularFireModule.initializeApp(firebaseConfig),
    AngularFireDatabaseModule,
    AngularFireAuthModule,
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp
  ],
  providers: [
    StatusBar,
    SplashScreen,
    StorageService,
    DatabaseService,
    Auth,
    Api,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    ValidateProvider
  ]
})
export class AppModule {}

我对此还是很陌生,我知道我只是想缺少一些东西,请帮忙。 谢谢

2 个答案:

答案 0 :(得分:0)

在您的app.module.ts中 删除import { firebaseConfig } from './config'; 或尝试删除Firebase并重新安装:npm plugin remove

答案 1 :(得分:0)

只需确保将Firebase配置正确链接到app.module.ts 谢谢