找不到模块'@ firebase / app-types / private' - Firebase抛出错误

时间:2021-06-25 19:42:38

I am working on application using angular and firebase. I installed firebase with the instructions given on site and the versions as follows,

我正在使用angular和firebase进行应用程序。我按照现场给出的说明安装了firebase,版本如下,

"angularfire2": "^5.0.0-rc.4",
"firebase": "^4.8.1",

but the following error comes

但是出现以下错误

ERROR in node_modules/@firebase/database/dist/esm/src/api/Database.d.ts(4,33): error TS2307: Cannot find module '@firebase/app-types/private'. node_modules/@firebase/database/dist/esm/src/core/AuthTokenProvider.d.ts(17,39): error TS2307: Cannot find module '@firebase/app-types/private'.

node_modules/@firebase/database/dist/esm/src/api/Database.d.ts(4,33)中的错误:错误TS2307:找不到模块'@ firebase / app-types / private'。 node_modules/@firebase/database/dist/esm/src/core/AuthTokenProvider.d.ts(179):错误TS2307:找不到模块'@ firebase / app-types / private'。

4 个解决方案

#1


43  

It's a known issue that it's a problem with the newest npm firebase package (v4.8.1).

这是一个众所周知的问题,它是最新的npm firebase软件包(v4.8.1)的问题。

You need to roll back your firebase version back to 4.8.0. It was an issue with type definitions and its no longer work after updating from 4.8.0 to 4.8.1.

您需要将firebase版本回滚到4.8.0。这是类型定义的问题,从4.8.0更新到4.8.1后它不再起作用。

To fix this one,

要解决这个问题,

Step 1: Uninstall with the following command

步骤1:使用以下命令卸载

npm uninstall --save firebase

Step 2: Now, open your package.json file. There, you will find:

第2步:现在,打开你的package.json文件。在那里,你会发现:

"angularfire2": "^5.0.0-rc.4"

Step 3: Below this line, add a this line (without the Caret(^) symbol): and save

第3步:在此行下方,添加一行(不带Caret(^)符号):并保存

"firebase": "4.8.0"

Step 4: Now do an npm install. Your app should work

第4步:现在进行npm安装。你的应用应该工作

Latest Update

最新更新

Hey guys! This specific issue has been resolved with the pull request #391. Ionic team will also be rolling back part of the change that surfaced this so you shouldn't see the issue any more ???? in the next release.

大家好!该特定问题已通过拉取请求#391解决。离子团队也将回滚部分变化,因此你不应该在下一个版本中看到问题。。

#2


4  

UPDATE April/2018:

更新于2018年4月:

package.json:

的package.json:

"angularfire2": "^5.0.0-rc.6",
"firebase": "^4.12.1",

npm install

npm安装

#3


3  

Solution:

解:

1. Inside package.json, remove ^ from "firebase": "^4.8.1"

1.在package.json中,从“firebase”中删除^:“^ 4.8.1”

1.1 Downgrade Firebase from 4.8.1 to 4.8.0 by changing 4.8.1 to 4.8.0

1.1通过将4.8.1更改为4.8.0,将Firebase从4.8.1降级到4.8.0

1.2 End result should look like this: "firebase": "4.8.0"

1.2最终结果应如下所示:“firebase”:“4.8.0”

2. Run npm update in the Project Root. NPM will downgrade Firebase for ya

2.在Project Root中运行npm update。 NPM会将Firebase降级为ya

3. Run ng serve --open to check for compilation errors. There shouldn't be any.

3.运行ng serve --open以检查编译错误。不应该有任何。

4. Enjoy!

4.享受!

Reason:

原因:

Firebase had introduced some breaking changes that AngularFire2 had not coped up with yet. Until the AngularFire2 team work it out, this will be the solution.

Firebase引入了AngularFire2尚未应对的一些重大变化。在AngularFire2团队解决之前,这将是解决方案。

#4


2  

firebase version 4.8.2 works for me:

firebase版本4.8.2适用于我:

"angularfire2": "^5.0.0-rc.4",
"firebase": "4.8.2",

#1


43  

It's a known issue that it's a problem with the newest npm firebase package (v4.8.1).

这是一个众所周知的问题,它是最新的npm firebase软件包(v4.8.1)的问题。

You need to roll back your firebase version back to 4.8.0. It was an issue with type definitions and its no longer work after updating from 4.8.0 to 4.8.1.

您需要将firebase版本回滚到4.8.0。这是类型定义的问题,从4.8.0更新到4.8.1后它不再起作用。

To fix this one,

要解决这个问题,

Step 1: Uninstall with the following command

步骤1:使用以下命令卸载

npm uninstall --save firebase

Step 2: Now, open your package.json file. There, you will find:

第2步:现在,打开你的package.json文件。在那里,你会发现:

"angularfire2": "^5.0.0-rc.4"

Step 3: Below this line, add a this line (without the Caret(^) symbol): and save

第3步:在此行下方,添加一行(不带Caret(^)符号):并保存

"firebase": "4.8.0"

Step 4: Now do an npm install. Your app should work

第4步:现在进行npm安装。你的应用应该工作

Latest Update

最新更新

Hey guys! This specific issue has been resolved with the pull request #391. Ionic team will also be rolling back part of the change that surfaced this so you shouldn't see the issue any more ???? in the next release.

大家好!该特定问题已通过拉取请求#391解决。离子团队也将回滚部分变化,因此你不应该在下一个版本中看到问题。。

#2


4  

UPDATE April/2018:

更新于2018年4月:

package.json:

的package.json:

"angularfire2": "^5.0.0-rc.6",
"firebase": "^4.12.1",

npm install

npm安装

#3


3  

Solution:

解:

1. Inside package.json, remove ^ from "firebase": "^4.8.1"

1.在package.json中,从“firebase”中删除^:“^ 4.8.1”

1.1 Downgrade Firebase from 4.8.1 to 4.8.0 by changing 4.8.1 to 4.8.0

1.1通过将4.8.1更改为4.8.0,将Firebase从4.8.1降级到4.8.0

1.2 End result should look like this: "firebase": "4.8.0"

1.2最终结果应如下所示:“firebase”:“4.8.0”

2. Run npm update in the Project Root. NPM will downgrade Firebase for ya

2.在Project Root中运行npm update。 NPM会将Firebase降级为ya

3. Run ng serve --open to check for compilation errors. There shouldn't be any.

3.运行ng serve --open以检查编译错误。不应该有任何。

4. Enjoy!

4.享受!

Reason:

原因:

Firebase had introduced some breaking changes that AngularFire2 had not coped up with yet. Until the AngularFire2 team work it out, this will be the solution.

Firebase引入了AngularFire2尚未应对的一些重大变化。在AngularFire2团队解决之前,这将是解决方案。

#4


2  

firebase version 4.8.2 works for me:

firebase版本4.8.2适用于我:

"angularfire2": "^5.0.0-rc.4",
"firebase": "4.8.2",