0
votes

I want to use firebase with Ionic 2. I got stuck with a tutorial because of the recent version of Ionic2. The github page says the following:

UPDATE MAY 14th 2016: Firebase AngularFire2 has been updated to work with the latest version of Angular2 and Ionic2 has not so this will only work if you load the specific version of AngularFire2 with your application

"angular2": "2.0.0-beta.13",
"angularfire2": "^2.0.0-alpha.16",

I think i have to edit my package.json file but i don't know how? EDIT: this is my package.json file after editing:

    {
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/http": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "es6-shim": "0.35.1",
    "ionic-angular": "2.0.0-beta.13",
    "ionic-native": "1.3.10",
    "ionicons": "3.0.0",
    "reflect-metadata": "0.1.8",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "0.6.12",
    "angular2": "2.0.0-beta.13",                   <--- added this one
    "angularfire2": "^2.0.0-alpha.16"              <--- and this
  },
  "devDependencies": {
    "del": "2.2.0",
    "gulp": "3.9.1",
    "gulp-watch": "4.3.5",
    "ionic-gulp-browserify-typescript": "2.0.0",
    "ionic-gulp-fonts-copy": "^1.0.0",
    "ionic-gulp-html-copy": "^1.0.0",
    "ionic-gulp-sass-build": "^1.0.0",
    "ionic-gulp-scripts-copy": "^2.0.0",
    "ionic-gulp-tslint": "^1.0.0",
    "tslint-ionic-rules": "0.0.4",
    "run-sequence": "1.1.5"
  },
  "name": "devdactic-firebase",
  "description": "devdactic-firebase: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": []
}

When i type npm install i get this error:

npm ERR! Windows_NT 10.0.10586 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR! node v6.5.0 npm ERR! npm v3.10.3

npm ERR! No compatible version found: [email protected] npm ERR! Valid install targets: npm ERR! 2.0.0-beta.9-201606271842,etc.....

npm ERR! npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request: npm ERR! C:\Users\s_a_m\Desktop\angular-tutorial\ionic\devdactic-firebase\npm-debug.log

Thanks in advance!

2

2 Answers

0
votes

If you know the angularFire version you want, you can just change it in the package.json file

"angularfire2": "^xxxVersion"

Then to be sure you can delete your node_modules folder, and re-run in your terminal npm install.

To read more on npm package click here

0
votes

I am working with firebase but with the version of ionic 2.2.3, try to use it because for me it works perfect.