Firebase-js-sdk: Cannot find module '@firebase/app-types/private'

Created on 21 Dec 2017  路  15Comments  路  Source: firebase/firebase-js-sdk


[REQUIRED] Describe your environment

  • Operating System version: Linux 4.13.0-21-generic #24-Ubuntu Ubuntu 17.10
  • Firebase SDK version: 4.8.1
  • Firebase Product: database

[REQUIRED] Describe the problem

I'm trying to build my angular application which uses firebase with 'ng build' command. But the build is broken with firebase 4.8.1 with following error message. 4.6.1 works well.

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'.
database

Most helpful comment

All 15 comments

This solved my issue, are type definitions going to be updated/fixed for future releases?

Hey guys! This specific issue has been resolved in #391. We 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.

Thanks!

Getting this with version 4.8.1. How can I add typedefinitions?
For me doing the following gives the error.

  import { FirebaseOptions } from '@firebase/app-types';

Hi guys, I am working on Ionic2 project with firebase

I tried this

  1. Inside package.json, remove ^ from "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.2 End result should look like this: "firebase": "4.8.0"
  2. Run npm update in the Project Root. NPM will downgrade Firebase for ya
  3. Run ionic serve to check for compilation errors

But unable to resolve the following issue in ionic2

typescript: Users/vyas/node_modules/@firebase/database/dist/esm/src/api/Database.d.ts, line: 4
Cannot find module '@firebase/app-types/private'.

   L3:  import { FirebaseApp } from '@firebase/app-types';
   L4:  import { FirebaseService } from '@firebase/app-types/private';

[08:59:27] typescript: ...rs/vyas/node_modules/@firebase/database/dist/esm/src/core/AuthTokenProvider.d.ts, line: 17
Cannot find module '@firebase/app-types/private'.

  L16:  getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData>;
  L17:  addTokenChangeListener(listener: (token: string | null) => void): void;
  L18:  removeTokenChangeListener(listener: (token: string | null) => void): void;

Can any body help me with this.

@vyasm9 Have you found the solution? I am having the same problem as you.

Yes I recreated the project and then installed angular fire
npm install angularfire2 [email protected] --save

And copied the old files into new project

@vyasm9 Thankyou so much!

hey By creating new file and copying old files into that will giv solution for the error .....?@vyasm9

Yes by I recreated the project and then installed angular fire like this will solve the issue.

npm install angularfire2 [email protected] --save

And copied the old files into new project

From a typings perspective it would appear that 4.8.1 / 4.8.2 was a big step forward but a small step back with this error. I'd hate to go back to 4.8.0 for this reason ... is there a way to address this error with 4.8.2?

Ok, I think I have an answer to my own question:

npm install --save-dev @firebase/app-types

Seems to do it for me.

@ksnyde the issue described here was fixed in version 4.8.2 (including the behavior you mentioned). Please feel free to open another issue if the currently released version isn't working properly for you and we can get it sorted out.

@jshcrowthe ok that's great news. Will there be a 4.8.2 release of the admin api soon? I have a series of libraries which use either 4.8.1 for admin-api (the latest currently) for backend consumers and 4.8.2 for the client consumers.

@ksnyde the Admin SDK takes a dependency on the @firebase/database module for this piece. It is a range version (currently ^0.1.3) so the updated 0.1.8 version should be picked up automatically on a clean NPM install.

Was this page helpful?
0 / 5 - 0 ratings