2016-09-26 54 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版本的工作,嘗試,因爲對我來說完美的作品使用它。