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?
yes, changed to .js and yes, using mac.
everything in the repo is exactly what i have locally right now.
When you import angularfire in main.ts, does it gives you the same error? Dude, that's so weird. Sorry.
@lexcaraig yeah, same error. Doesn't matter if it's .ts or .js. I've never encountered this before. I've worked in other angular2 apps using angular-cli and imported third party libraries and it worked fine. it's only with this situation that i'm hitting this error.
Did you try creating one again from scratch like after you clean the cache and reinstalling cli again? I think i'm getting it right now. I remember i used to get same error before but after reinstalling cli and start from scratch again, like from number 1 in the set up. I finally realize that Im just too excited to code and when i npm install angularfire2 firebase --save I've wait until self termination occur, and then the error is gone.
But I dont think you have done this before? Haha. Just trying man, I just help.
ok, i'll give it a shot now and see what happens. it shouldn't take that long. just a few minutes.
so far:
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest
npm install -g angular-cli
npm install -g typings
ng new test-project
cd test-project
npm install angularfire2 firebase --save
got the errors but i'm ignoring them and moving foward.
➜ test-project git:(master) npm install angularfire2 firebase --save
> [email protected] install /Users/jasonshultz/Projects/test-project/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/jasonshultz/Projects/test-project/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] /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]
│ ├─┬ [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]
│ ├── [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]
│ │ ├── [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]
│ │ │ └─┬ [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]
│ │ ├─┬ [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]
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.
I created a github repo for this: https://github.com/thehashrocket/test-project/
I'm just about to run the typings program. i'm going to do a commit after each step.
does it work when you serve?
let me try. i just ran typings install file:node_modules/angularfire2/firebase3.d.ts --save --global && typings install but haven't gone any further. committed my code.
ng serve works so far.
No errors so far in console.?
@lexcaraig should i be doing this?
typings install --save --global es6-promise
no errors in console.
wait not yet
so i should go ahead to step 4. Open angular-cli-build.js.
Actually, you don't need to use typings install --save --global es6-promise just add the files because you are not targeting es6 output.
"files": [
"main.ts",
"typings.d.ts",
"node_modules/angularfire2/firebase3.d.ts"
]
ok, committed the next steps. so far, no errors in ng build, no errors in console.
Then i guess you just have to follow the next other steps. I guess it will work now. I hope so. Haha.