2016-09-26 37 views
0

我想在Ionic 2中使用Firebase。由于最近版本的Ionic2,我因为教程而陷入困境。该github page说以下内容:与Ionic 2一起使用Firebase

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", 

我想我已经编辑我的package.json文件,但我不知道怎么样? 编辑:这是我的package.json文件编辑后:

{ 
    "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": [] 
} 

当我输入npm install我得到这个错误:

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

提前感谢!

回答

0

如果你知道你想要的angularFire版本,你可以改变它在的package.json文件

"angularfire2": "^xxxVersion" 

然后,以确保你能删除你的node_modules文件夹,并在终端npm install重新运行。

要了解更多关于NPM包click here

+0

离子角和角2具有相同的版本是正确的吗? –

+0

试图删除angular2行并离开离子角度但仍然得到相同的错误 –

+0

是的也许离子版本是不正确的?这是npm模块https://www.npmjs.com/package/ionic-angular?如果是这样,这是最新版本'v2.0.0-beta.11' @Samvanbeastlo –

0

我与火力,但与离子2.2.3版本的工作,尝试,因为对我来说完美的作品使用它。