AngularFire2 - 找不到模块@ firebase/database

Mat*_*att 9 firebase ionic-framework ionic2 angularfire2

我已经为项目安装和使用了很多次AngularFire2,但是自从v5发布以来,我无法正确设置它.

这些是我为解决问题而采取的步骤.

$ ionic start angularfire2test tabs
$ npm install angularfire2 firebase --save
Run Code Online (Sandbox Code Playgroud)

的package.json

"angularfire2": "^5.0.0-rc.3",
"firebase": "^4.5.2",
Run Code Online (Sandbox Code Playgroud)

将Firebase凭据添加到app.module.ts +导入默认模块和数据库模块.这是最重要的部分

import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabaseModule } from 'angularfire2/database';
...
@NgModule({
  declarations: [
    MyApp,
    AboutPage,
    ContactPage,
    HomePage,
    TabsPage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    AngularFireModule.initializeApp(firebaseCredentials),
    AngularFireDatabaseModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [
   ....
Run Code Online (Sandbox Code Playgroud)

当我执行时$ ionic serve,我在webpackMissingModule(http:// localhost:8100/build/vendor.js:119190:82)收到错误消息"找不到模块"@ firebase/database"

检查node_modules文件夹时,@ firebase没有数据库子文件夹,但firebase-folder确实有一个数据库文件夹.

我做错了什么或是AngularFire2的一般问题?

Mat*_*att 10

我认为这与npm的问题有关.使用纱线安装模块时,一切都完美无瑕.

yarn add angularfire2 firebase
Run Code Online (Sandbox Code Playgroud)

tldr:节点:8.4.0/npm:5.2.0有问题,纱线工作