Cannot find module 'angularfire2' when using Angular-CLI and RC.4
I'm using angular-cli with the lastest RC4 version of Angular.
I was following the steps here:
https://github.com/angular/angularfire2/blob/master/docs/1-install-and-setup.md
But I had to make a few very small changes. For one, I'm installing AngularFire this way:
npm install git+https://github.com/angular/angularfire2.git --save so that I have a version that is compatible with RC4.
Secondly, when doing the typings step I do this:
typings install file:node_modules/firebase/firebase.d.ts --save --global && typings install because that's where the firebase.d.ts file is now it seems.
Next I do this:
var map = {
'firebase': 'vendor/firebase/firebase.js',
'angularfire2': 'vendor/angularfire2'
};
/** User packages configuration. */
var packages = {
angularfire2: {
defaultExtension: 'ts',
main: 'angularfire2.ts'
}
};
Where I use the .ts file because there isn't a .js file for angularfire2 in the node_modules/angularfire2 folder. Even in the source folder it's just .ts files.
So, once I get to step 7, and do this:
import { FIREBASE_PROVIDERS, defaultFirebase } from 'angularfire2';
everything falls apart. I'm not sure why, it should work?
Hi. Did you install the 'firebase' ? Or did you do the ng build command? Because it will create a folder for angularfire and firebase in the vendor folder.
Hey, @lexcaraig , thank you for the fast response!
I did npm install --save firebase@latest
I also did ng build at the appropriate time to build the dist folder.
May your default extension should be .js and not .ts ?
Here is my packages:
const packages: any = {
angularfire2: {
dafaultExtension: 'js',
main: 'angularfire2.js'
}
};
Its actually working on my side.
@lexcaraig The file is angularfire2.ts in the folder, not angularfire2.js which is why I have the extension as .ts.
@thehashrocket Here is mine. There is a big difference between mine and yours. Maybe the version of angularfire2?

This is the version of my angularfire2
"angularfire2": "^2.0.0-beta.2"
Probably. In package.json I'm doing:
"angularfire2": "git+https://github.com/angular/angularfire2.git",
But that's because if I use the version you are then I get the following errors:
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
have you tried installing the angularfire suggested in the setup? Actually that's what I'm using and its working on RC4.
Believe me, I'm trying to get your error but I can't. It works fine on me.
May be use npm install angularfire2 firebase --save instead of the github link you are using.
I'm not sure what's wrong, if I try it that way, it fails with the unmet peer dependency.
here's the console log: https://gist.github.com/thehashrocket/114686142f9c124054eaedc29b962be8
here's what my package.json looks like:
https://gist.github.com/thehashrocket/8331d1dca02ea8d16b7136e74ab8cb15
I tried npm cache clean and then ran it again:
➜ test-project git:(master) ✗ npm cache clean
➜ test-project git:(master) ✗ npm install angularfire2 firebase --save
[email protected] /Users/jasonshultz/Projects/test-project
├── UNMET PEER DEPENDENCY @angular/[email protected]
├── UNMET PEER DEPENDENCY @angular/[email protected]
├── UNMET PEER DEPENDENCY @angular/[email protected]
├── UNMET PEER DEPENDENCY @angular/[email protected]
├── UNMET PEER DEPENDENCY @angular/[email protected]
├── [email protected]
└── [email protected]
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
@thehashrocket even with that error, it will still work fine... here is a link to my repo - https://github.com/aaronksaunders/afwithngcli
@aaronksaunders I thought that UNMET PEER DEPENDENCY is bad? Doesn't that mean that it needs something and it's not there so it won't work?
This just looks like it's not working right:
➜ angular-analytics git:(master) ✗ npm cache clean
➜ angular-analytics git:(master) ✗ npm install angularfire2 firebase --save
[email protected] /Users/jasonshultz/Projects/angular-analytics
├── UNMET DEPENDENCY @angular/[email protected]
├── UNMET DEPENDENCY @angular/[email protected]
├── UNMET DEPENDENCY @angular/[email protected]
├── UNMET DEPENDENCY @angular/[email protected]
├── UNMET DEPENDENCY @angular/[email protected]
├── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ ├─┬ [email protected]
│ │ │ │ │ ├── [email protected]
│ │ │ │ │ ├─┬ [email protected]
│ │ │ │ │ │ ├── [email protected]
│ │ │ │ │ │ ├── [email protected]
│ │ │ │ │ │ └── [email protected]
│ │ │ │ │ └── [email protected]
│ │ │ │ └─┬ [email protected]
│ │ │ │ ├─┬ [email protected]
│ │ │ │ │ ├── [email protected]
│ │ │ │ │ └── [email protected]
│ │ │ │ ├─┬ [email protected]
│ │ │ │ │ ├── [email protected]
│ │ │ │ │ └─┬ [email protected]
│ │ │ │ │ └─┬ [email protected]
│ │ │ │ │ └── [email protected]
│ │ │ │ ├── [email protected]
│ │ │ │ └── [email protected]
│ │ │ └─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ └── [email protected]
└── UNMET DEPENDENCY [email protected]
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of [email protected] but none was installed.
➜ angular-analytics git:(master) ✗ npm install
npm WARN deprecated [email protected]: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
> [email protected] install /Users/jasonshultz/Projects/angular-analytics/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/jasonshultz/Projects/angular-analytics/node_modules/fsevents/lib/binding/Release/node-v47-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
> [email protected] postinstall /Users/jasonshultz/Projects/angular-analytics
> typings install
typings ERR! message Unable to read typings for "firebase3". You should check the entry paths in "firebase3.d.ts" are up to date
typings ERR! caused by ENOENT: no such file or directory, open '/Users/jasonshultz/Projects/angular-analytics/node_modules/angularfire2/manual_typings/firebase3/firebase3.d.ts'
typings ERR! cwd /Users/jasonshultz/Projects/angular-analytics
typings ERR! system Darwin 16.0.0
typings ERR! command "/usr/local/Cellar/node/5.10.1/bin/node" "/Users/jasonshultz/Projects/angular-analytics/node_modules/.bin/typings" "install"
typings ERR! node -v v5.10.1
typings ERR! typings -v 1.3.1
typings ERR! If you need help, you may report this error at:
typings ERR! <https://github.com/typings/typings/issues>
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/Cellar/node/5.10.1/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.10.1
npm ERR! npm v3.10.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'typings install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-analytics package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-analytics
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-analytics
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jasonshultz/Projects/angular-analytics/npm-debug.log
without seeing your complete project configuration, showing error logs and console output can only do so much, sorry
Aaron K. Saunders CEO Clearly Innovative Inc. [email protected] www.clearlyinnovative.com @aaronksaunders
This email message and any attachment(s) are for the sole use of the intended recipient(s) and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient(s), please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachment(s) to the original message.
On Sun, Jul 31, 2016 at 5:39 PM, Jason Shultz [email protected] wrote:
npm WARN deprecated [email protected]: This package has been discontinued in favor of lodash@^4.0.0. npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade npm WARN deprecated [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead. npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130 npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[email protected] install /Users/jasonshultz/Projects/angular-analytics/node_modules/fsevents node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/jasonshultz/Projects/angular-analytics/node_modules/fsevents/lib/binding/Release/node-v47-darwin-x64/fse.node" already installed Pass --update-binary to reinstall or --build-from-source to recompile
[email protected] postinstall /Users/jasonshultz/Projects/angular-analytics typings install
typings ERR! message Unable to read typings for "firebase3". You should check the entry paths in "firebase3.d.ts" are up to date typings ERR! caused by ENOENT: no such file or directory, open '/Users/jasonshultz/Projects/angular-analytics/node_modules/angularfire2/manual_typings/firebase3/firebase3.d.ts'
typings ERR! cwd /Users/jasonshultz/Projects/angular-analytics typings ERR! system Darwin 16.0.0 typings ERR! command "/usr/local/Cellar/node/5.10.1/bin/node" "/Users/jasonshultz/Projects/angular-analytics/node_modules/.bin/typings" "install" typings ERR! node -v v5.10.1 typings ERR! typings -v 1.3.1
typings ERR! If you need help, you may report this error at: typings ERR! https://github.com/typings/typings/issues
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed. npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed. npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed. npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed. npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed. npm ERR! Darwin 16.0.0 npm ERR! argv "/usr/local/Cellar/node/5.10.1/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v5.10.1 npm ERR! npm v3.10.5 npm ERR! code ELIFECYCLE npm ERR! [email protected] postinstall:
typings installnpm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] postinstall script 'typings install'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the angular-analytics package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! typings install npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs angular-analytics npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls angular-analytics npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! /Users/jasonshultz/Projects/angular-analytics/npm-debug.log
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular/angularfire2/issues/401#issuecomment-236458291, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgCmT4W2-quX8yD5MwNPJtR6HckQ5Amks5qbRX7gaJpZM4JY9zu .
@aaronksaunders no prob, gimme 5 minutes tops. i'll post to github.
ok, here it is: https://github.com/thehashrocket/angular-analytics
Is this now working?
@lexcaraig nope, afraid not. :(
I also updated the stackoverflow: http://stackoverflow.com/questions/38681156/how-to-resolve-cannot-find-module-angularfire2-when-using-angular-cli-and-rc-4
I put the code on github as well: https://github.com/thehashrocket/angular-analytics
there's an issue on it also: https://github.com/thehashrocket/angular-analytics/issues/1
I saw your config on github. Did you change your default extn to .js already?
You are using mac right?