我正在尝试将ionic-native更新到3.4.3版
但它不起作用。它已更新到版本 2.9.0,这是最后一个 2.x 版本。
如何更新更多?
如果我将package.json中的版本更改为3.4.3,则会显示:
npm ERR! notarget No compatible version found: ionic-native@3.4.3
npm ERR! notarget Valid install targets:
npm ERR! notarget 2.9.0, 2.8.1, 2.8.0, 2.7.0, 2.6.0, 2.5.1, 2.5.0, 2.4.1, 2.4.0, 2.3.2, 2.3.1, 2.3.0, 2.2.17, 2.2.16, 2.2.15, 2.2.14, 2.2.13, 2.2.12, 2.2.11, 2.2.10, 2.2.9, 2.2.8, 2.2.7, 2.2.6, 2.2.5, 2.2.4, 2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.9, 2.1.8, 2.1.7, 2.1.6, 2.1.5, 2.1.4, 2.1.3, 2.1.2, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 1.3.27, 1.3.26, 1.3.25, 1.3.24, 1.3.23, 1.3.22, 1.3.21, 1.3.20, 1.3.19, 1.3.18, 1.3.17, 1.3.16, 1.3.15, 1.3.14, 1.3.13, 1.3.12, 1.3.11, 1.3.10, 1.3.9, 1.3.8, 1.3.7, 1.3.6, 1.3.5, 1.3.4, 1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.1, 1.1.0, 1.0.12, 1.0.11, 1.0.10, 1.0.9, 1.0.8, 1.0.7
你知道为什么吗?
我的离子版本:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.3
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
谢谢
编辑:
package.json:
"dependencies": {
"@angular/common": "^4.0.1",
"@angular/compiler": "4.0.1",
"@angular/compiler-cli": "4.0.1",
"@angular/core": "^4.0.1",
"@angular/forms": "4.0.1",
"@angular/http": "4.0.1",
"@angular/platform-browser": "4.0.1",
"@angular/platform-browser-dynamic": "4.0.1",
"@angular/platform-server": "4.0.1",
"@ionic-native/core": "^3.4.3",
"@ionic/storage": "^2.0.1",
"chart.js": "^2.4.0",
"ionic-angular": "2.3.0",
"ionic-native": "3.4.3",
"ionicons": "3.0.0",
"midata": "git+https://github.com/i4mi/midata.js.git#v1.4",
"ng2-charts": "^1.4.4",
"pouchdb": "^6.1.0",
"rxjs": "5.2.0",
"zone.js": "0.8.5"
},
编辑2:
"dependencies": {
"@angular/common": "2.4.8",
"@angular/compiler": "2.4.8",
"@angular/compiler-cli": "2.4.8",
"@angular/core": "2.4.8",
"@angular/forms": "2.4.8",
"@angular/http": "2.4.8",
"@angular/platform-browser": "2.4.8",
"@angular/platform-browser-dynamic": "2.4.8",
"@angular/platform-server": "2.4.8",
"@ionic-native/core": "3.1.0",
"@ionic-native/splash-screen": "3.1.0",
"@ionic-native/status-bar": "3.1.0",
"@ionic/storage": "2.0.0",
"ionic-angular": "2.3.0",
"ionicons": "3.0.0",
"rxjs": "5.0.1",
"sw-toolbox": "3.4.0",
"zone.js": "0.7.2"
},
"devDependencies": {
"@ionic/app-scripts": "^1.0.0",
"typescript": "2.2.2"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard",
"ionic-plugin-keyboard@~2.2.1",
"cordova-plugin-whitelist@1.3.1",
"cordova-plugin-console@1.0.5",
"cordova-plugin-statusbar@2.2.1",
"cordova-plugin-device@1.1.4",
"cordova-plugin-splashscreen@~4.0.1",
"cordova-plugin-screen-orientation",
"cordova-plugin-camera",
"cordova-plugin-inappbrowser",
"cordova-plugin-network-information",
"cordova-sqlite-storage",
"cordova-sqlite-storage@~2.0.2",
"cordova-plugin-file",
"cordova-plugin-secure-storage"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "OnkoApp2: An Ionic project"
}
更新
您必须将所有本机软件包更新为最新版本,如下所示。
"@ionic-native/core": "3.4.3",
"@ionic-native/splash-screen": "3.4.3",
"@ionic-native/status-bar": "3.4.3",
之后:npm i
旧答案
您只需要在package.json
文件上执行此操作。
用这个"@ionic-native/core": "3.1.0",
替换旧的("ionic-native": "2.2.11"
(
之后运行npm i
注意:您必须在Ionic2
应用中使用 "@angular/core": "2.4.8"
。尚无Angular4
支持。
您的package.json
文件应该是这样的。
"dependencies": {
"@angular/common": "2.4.8",
"@angular/compiler": "2.4.8",
"@angular/compiler-cli": "2.4.8",
"@angular/core": "2.4.8",
"@angular/forms": "2.4.8",
"@angular/http": "2.4.8",
"@angular/platform-browser": "2.4.8",
"@angular/platform-browser-dynamic": "2.4.8",
"@angular/platform-server": "2.4.8",
"@ionic-native/core": "3.1.0",
"@ionic-native/splash-screen": "3.1.0",
"@ionic-native/status-bar": "3.1.0",
"@ionic/storage": "2.0.0",
"ionic-angular": "2.3.0",
"ionicons": "3.0.0",
"rxjs": "5.0.1",
"sw-toolbox": "3.4.0",
"zone.js": "0.7.2"
},