运行ionic serve
[ng] WARNING in /home/brian/node_modules/@angular/core/@angular/core.es5.js
[ng] 5659:15-36 Critical dependency: the request of a dependency is an expression
[ng] WARNING in /home/brian/node_modules/@angular/core/@angular/core.es5.js
[ng] 5675:15-102 Critical dependency: the request of a dependency is an expression
[ng] ERROR in /home/brian/node_modules/angularfire2/angularfire2.js
[ng] Module not found: Error: Can't resolve '@angular/common' in '/home/brian/node_modules/angularfire2'
[ng] ERROR in /home/brian/node_modules/rxjs-compat/_esm5/Observable.js
[ng] Module not found: Error: Can't resolve 'rxjs/internal/Observable' in '/home/brian/node_modules/rxjs-compat/_esm5'
[ng] ℹ 「wdm」: Failed to compile.
我正在使用此版本:
-Linux Mint 18 Cinnamon 64位
-离子4.1.2
-npm 6.4.1
-节点v8.12.0
这是我的package.json文件:
{
"name": "bin",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@angular/core": "^4.4.6",
"angular": "^1.7.0",
"angularfire2": "^5.0.0-rc.9",
"firebase": "^5.0.3",
"npm": "^6.4.1",
"rxjs": "^5.5.12",
"rxjs-compat": "^6.3.2",
"typescript": "^2.4.0"
}
}
这是一个非常简单的代码,我刚刚创建了一个新的离子项目ionic start fleksales sidemenu
然后在 app.module.ts 下,我将代码编辑如下:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule, RouteReuseStrategy, Routes } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AngularFireModule } from 'angularfire2';
import { FIREBASE_CREDENTIALS } from './firebase.credentials';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
// initialize AngularFire
AngularFireModule.initializeApp(FIREBASE_CREDENTIALS)
],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
任何想法如何解决此问题?任何帮助,将不胜感激。谢谢!