angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Module '"/node_modules/angularfire2/angularfire2"' has no exported member 'AngularFireModule'.

Open DMPS opened this issue 10 years ago • 51 comments

I am trying to use the latest version of AngularFire with the webpack 2 angular-cli and RC.5. However when I try to setup my firebase I get this error:

Module '"C:/Users/dalto/Documents/Deadspot/node_modules/angularfire2/angularfire2"' has no exported member 'AngularFireModule'.

I have checked angularFire but I do not see any AngularFireModule exported.

DMPS avatar Aug 12 '16 14:08 DMPS

Haven't released the RC5 version yet. Should have it out today.

It's also worth noting we haven't experimented with AngularFire2 and the Webpack version of the CLI.

davideast avatar Aug 12 '16 15:08 davideast

@DMPS if you are on a hurry you can pull the repo from github instead of npm using npm install git+https://github.com/angular/angularfire2.git And then import from the src folder: import { AngularFireModule } from 'angularfire2/src/angularfire2'; (worked for me)

lfarroco avatar Aug 12 '16 16:08 lfarroco

@lfarroco @DMPS While that will work, installing from master is a risky business. Proceed cautiously :)

davideast avatar Aug 12 '16 16:08 davideast

@lfarroco @DMPS Can you try the pre-release version?

npm install firebase angularfire2@next --save

davideast avatar Aug 13 '16 00:08 davideast

@davideast

I am getting this errors:

[1] node_modules/angularfire2/auth/auth.d.ts(11,20): error TS1112: A class member cannot be declared optional.
[1] node_modules/angularfire2/database/firebase_object_observable.d.ts(6,17): error TS1112: A class member cannot be declared optional.

vladotesanovic avatar Aug 13 '16 00:08 vladotesanovic

@vladotesanovic What version of Typescript are you on? This requires 2.0+

davideast avatar Aug 13 '16 00:08 davideast

@davideast Yes i see now in package.json "typescript": "next" it is good now :+1:

vladotesanovic avatar Aug 13 '16 00:08 vladotesanovic

My application is running fine, though I still have few reading and saving operations.

lfarroco avatar Aug 13 '16 00:08 lfarroco

@davideast can you give us some tips to get it working with the webpack version of the angular-cli?

danielgek avatar Aug 13 '16 17:08 danielgek

well adding "firebase" to tsconfig.json in types array seem to work!

danielgek avatar Aug 13 '16 18:08 danielgek

I'm using the same angular-cli@webpack and still having the same issues after following the suggested solutions. I'm still getting the error of cannot find namespace 'firebase'.

These are the steps I took:

  1. npm install firebase angularfire2@next --save
  2. npm install [email protected] --save-dev

package.json imgur link

import { AngularFireModule } from 'angularfire2';

What am I missing?

RedFour avatar Aug 16 '16 02:08 RedFour

@RedFour You might try copying the firebase3.d.ts to your typings folder, or typings install firebase.

lfarroco avatar Aug 16 '16 14:08 lfarroco

I've tried both your suggestions and still get the same error of can't find firebase.

RedFour avatar Aug 16 '16 22:08 RedFour

@RedFour Can I see your tsconfig.json file?

davideast avatar Aug 16 '16 22:08 davideast

{
  "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": ["es6", "dom"],
    "mapRoot": "./",
    "module": "es6",
    "moduleResolution": "node",
    "outDir": "../dist/out-tsc",
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [
      "../node_modules/@types"
    ],
    "types": [
      "jasmine"
    ]
  }
}

RedFour avatar Aug 16 '16 22:08 RedFour

@RedFour add "firebase" to types array

danielgek avatar Aug 16 '16 22:08 danielgek

like this?

{
  "compilerOptions": {
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": ["es6", "dom"],
    "mapRoot": "./",
    "module": "es6",
    "moduleResolution": "node",
    "outDir": "../dist/out-tsc",
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [
      "../node_modules/@types"
    ],
    "types": [
      "jasmine",
      "firebase"
    ]
  }
}

RedFour avatar Aug 16 '16 22:08 RedFour

yup

danielgek avatar Aug 16 '16 22:08 danielgek

I'm still getting the same errors.

RedFour avatar Aug 16 '16 22:08 RedFour

@RedFour run npm list at the root of the project and send a gist or pastbin with the output

danielgek avatar Aug 16 '16 22:08 danielgek