我最近犯了一个错误。我添加了一些与Ionic 3不兼容的本机插件(例如,在我的package.json
中,我有"@ionic-native/file": "^5.XX.X"
。
我检测到这是一个错误,因此我决定: 1-用这些行卸载插件
sudo ionic cordova plugin remove cordova-plugin-file
sudo npm uninstall --save @ionic-native/file
sudo rm -r node_modules/@ionic-native
2-使用以下代码行重新安装插件
sudo ionic cordova plugin add cordova-plugin-file
sudo npm install --save @ionic-native/file@4
3-我也尝试运行npm install --save
但是我要使用该插件的所有类仍然有错误:无法解析......的所有参数
这是我的```àpp.module.ts````
...
import { File } from '@ionic-native/file';
@NgModule({
declarations: [
MyApp,
HomePage,
...
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
...
],
providers: [
...
File,
...
]
})
export class AppModule {}
这是我的package.json
{
"name": "myAppName",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint"
},
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/core": "^4.20.0",
"@ionic-native/email-composer": "^4.20.0",
"@ionic-native/file": "^4.20.0",
"@ionic-native/file-opener": "^4.20.0",
"@ionic-native/in-app-browser": "^4.20.0",
"@ionic-native/splash-screen": "~4.18.0",
"@ionic-native/status-bar": "~4.18.0",
"@ionic/pro": "2.0.4",
"@ionic/storage": "2.2.0",
"cordova-android": "7.1.4",
"cordova-plugin-email-composer": "^0.9.2",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-opener2": "^2.2.1",
"cordova-plugin-inappbrowser": "^3.1.0",
"ionic-angular": "3.9.9",
"ionic-native": "^2.9.0",
"ionicons": "3.0.0",
"pdfmake": "^0.1.60",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"xlsx": "^0.14.4",
"zone.js": "0.8.29"
},
"devDependencies": {
"@ionic/app-scripts": "^3.2.4",
"@ionic/lab": "1.0.20",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-email-composer": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-file-opener2": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-file": {}
}
}
}
当然,在我的课程中,我导入以下行:import { File } from '@ionic-native/file';
您有解决我问题的主意吗?