我想在Ionic 2中使用firebase . 由于Ionic2的最新版本,我被困在教程中 . github page说以下内容:
更新2016年5月14日:Firebase AngularFire2已更新为使用最新版本的Angular2而Ionic2尚未更新,只有在您的应用程序加载特定版本的AngularFire2时才能使用
"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!节点v6.5.0 npm ERR! npm v3.10.3 npm ERR!未找到兼容的版本:ionic-angular@2.0.0-beta.13 npm ERR!有效安装目标:npm ERR! 2.0.0-beta.9-201606271842等...... npm ERR!错误的ERR!错误的ERR!如果您需要帮助,可以在以下位置报告此错误:npm ERR! https://github.com/npm/npm/issues npm ERR!请在任何支持请求中包含以下文件:npm ERR! C:\ Users \用户s_a_m \桌面\角教程\离子\ devdactic-火力\ NPM-的debug.log
提前致谢!
2 回答
如果你知道你想要的angularFire版本,你可以在package.json文件中更改它
然后确保您可以删除node_modules文件夹,并在终端
npm install
中重新运行 .关于npm包的更多信息click here
我正在使用firebase但是使用离子2.2.3的版本,尝试使用它,因为对我来说它完美无缺 .