我想在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 错误的ERR! argv&#34; C:\ Program Files \ nodejs \ node.exe&#34; &#34; C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ npm-cli.js&#34; &#34;安装&#34; 错误的ERR!节点v6.5.0 错误的ERR! npm v3.10.3
npm ERR!未找到兼容的版本:ionic-angular@2.0.0-beta.13 错误的ERR!有效的安装目标: 错误的ERR! 2.0.0-beta.9-201606271842等.....
npm ERR! 错误的ERR! 错误的ERR!如果您需要帮助,可以在以下位置报告此错误: 错误的ERR! https://github.com/npm/npm/issues
npm ERR!请在任何支持请求中包含以下文件: 错误的ERR! C:\ Users \用户s_a_m \桌面\角教程\离子\ devdactic-火力\ NPM-的debug.log
提前致谢!
答案 0 :(得分:0)
如果你知道你想要的angularFire版本,你可以在package.json文件中更改它
"angularfire2": "^xxxVersion"
然后确保您可以删除node_modules文件夹,并在终端npm install
中重新运行。
详细了解npm package click here
答案 1 :(得分:0)
我正在使用firebase但是使用离子2.2.3的版本,尝试使用它,因为对我来说它完美无缺。