Angular 找不到命名空间';firebase';安圭拉5号项目

Angular 找不到命名空间';firebase';安圭拉5号项目,angular,firebase,angularfire2,tsconfig,Angular,Firebase,Angularfire2,Tsconfig,我试图将angularfire2和firebase集成到Angular5项目中,但它给出了“firebase”名称空间错误 package.json 我尝试了以下解决方案,但没有一个能解决我的问题 将*作为firebase从app.module.ts中的“firebase”导入 tsconfig.json中的“类型”:[“firebase”] 使用“npm安装--保存@types/firebase”安装@types/firebase 在所有这些之后,我已经用“typings install

我试图将angularfire2和firebase集成到Angular5项目中,但它给出了“firebase”名称空间错误

package.json

我尝试了以下解决方案,但没有一个能解决我的问题

  • 将*作为firebase从app.module.ts中的“firebase”导入
  • tsconfig.json中的“类型”:[“firebase”]
  • 使用“npm安装--保存@types/firebase”安装@types/firebase
在所有这些之后,我已经用“typings install firebase--save”安装了firebase typings,并在tsconfig.json中添加了“files”:[“typings/index.d.ts”]”。它从控制台中删除了名称空间的所有错误,但当我在浏览器中检查localhost:4200时,并没有在那个里呈现任何视图。通过检查元素,我可以看到没有在中渲染视图

tsconfig.json


您的问题已发布在此处:

因此,在firebase发布新版本时,您应该继续使用旧版本的
firebase

npm uninstall --save firebase
npm install --save firebase@4.8.0
{
    "compileOnSave": false,
    "compilerOptions": {
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "moduleResolution": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "target": "es5",
        "typeRoots": [
            "node_modules/@types"
        ],
        "lib": [
            "es2017",
            "dom"
        ],
        "types": [
            "firebase"
        ]
    },
    "files": [
        "typings/index.d.ts"
    ]
}
npm uninstall --save firebase
npm install --save firebase@4.8.0