Ionic 7 本机安装依赖错误

问题描述 投票:0回答:0

刚开始学习用Ionic做app,正在尝试学习如何使用ionic原生的cordova函数。这是课程的一部分,为课程提供的视频已经过时 9 年了。我试图通过它们,遇到了很多错误,然后开始自己的研究,发现 cordova 已经停产,所以该文件夹安装了一些过时的东西。不幸的是,因为我现在正在尝试学习,所以我不知道如何删除这些旧文件或我应该删除的内容。我需要关于移除什么、如何移除以及我需要做什么的说明,以解决我在尝试安装电容器时遇到的一连串错误。我的最终目标是能够将手机的相机与我的应用程序一起使用来拍照并将它们与应用程序中的其他一些信息相关联。 请注意,我已经尝试完成这项工作 4 天了,所以我不记得我尝试过的所有内容,但这是我可以在谷歌上搜索到的关于该主题的所有内容。最近的尝试是更改 package.json 文件以使其使用它似乎想要的 rxjs 版本,但这似乎没有帮助。这是最新的尝试及其错误:

npm install @awesome-cordova-plugins/core --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/rxjs
npm ERR!   peer rxjs@"^5.5.0 || ^6.5.0" from @ionic-native/[email protected]
npm ERR!   node_modules/@ionic-native/core
npm ERR!     peer @ionic-native/core@"^5.1.0" from @ionic-native/[email protected]
npm ERR!     node_modules/@ionic-native/social-sharing
npm ERR!       @ionic-native/social-sharing@"^5.36.0" from the root project
npm ERR!   peer rxjs@"^5.5.0 || ^6.5.0" from @ionic-native/[email protected]
npm ERR!   node_modules/@ionic-native/social-sharing
npm ERR!     @ionic-native/social-sharing@"^5.36.0" from the root project
npm ERR!   2 more (the root project, @awesome-cordova-plugins/core)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   peer @angular/common@"15.2.6" from @angular/[email protected]
npm ERR!   node_modules/@angular/forms
npm ERR!     peer @angular/forms@">=12.0.0" from @ionic/[email protected]
npm ERR!     node_modules/@ionic/angular
npm ERR!       @ionic/angular@"^6.1.9" from the root project
npm ERR!     1 more (the root project)
npm ERR!   peer @angular/common@"15.2.6" from @angular/[email protected]
npm ERR!   node_modules/@angular/platform-browser
npm ERR!     peer @angular/platform-browser@"15.2.6" from @angular/[email protected]
npm ERR!     node_modules/@angular/forms
npm ERR!       peer @angular/forms@">=12.0.0" from @ionic/[email protected]
npm ERR!       node_modules/@ionic/angular
npm ERR!       1 more (the root project)
npm ERR!     3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR!   3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/rxjs
npm ERR!   peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]
npm ERR!   node_modules/@angular/common
npm ERR!     peer @angular/common@"15.2.6" from @angular/[email protected]
npm ERR!     node_modules/@angular/forms
npm ERR!       peer @angular/forms@">=12.0.0" from @ionic/[email protected]
npm ERR!       node_modules/@ionic/angular
npm ERR!         @ionic/angular@"^6.1.9" from the root project
npm ERR!       1 more (the root project)
npm ERR!     peer @angular/common@"15.2.6" from @angular/[email protected]
npm ERR!     node_modules/@angular/platform-browser
npm ERR!       peer @angular/platform-browser@"15.2.6" from @angular/[email protected]
npm ERR!       node_modules/@angular/forms
npm ERR!         peer @angular/forms@">=12.0.0" from @ionic/[email protected]
npm ERR!         node_modules/@ionic/angular
npm ERR!         1 more (the root project)
npm ERR!       3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR!     3 more (@angular/platform-browser-dynamic, @angular/router, the root project)
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

和 package.json

    {
  "name": "groceries2",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "lint": "ng lint"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^15.0.0",
    "@angular/core": "^15.0.0",
    "@angular/forms": "^15.0.0",
    "@angular/platform-browser": "^15.0.0",
    "@angular/platform-browser-dynamic": "^15.0.0",
    "@angular/router": "^15.0.0",
    "@capacitor/android": "^4.7.3",
    "@capacitor/app": "4.1.1",
    "@capacitor/core": "4.7.1",
    "@capacitor/haptics": "4.1.0",
    "@capacitor/ios": "^4.7.3",
    "@capacitor/keyboard": "4.1.1",
    "@capacitor/status-bar": "4.1.1",
    "@ionic-native/social-sharing": "^5.36.0",
    "@ionic/angular": "^6.1.9",
    "ionic-native": "^2.9.0",
    "ionicons": "^6.0.3",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.0.0",
    "@angular-eslint/builder": "^15.0.0",
    "@angular-eslint/eslint-plugin": "^15.0.0",
    "@angular-eslint/eslint-plugin-template": "^15.0.0",
    "@angular-eslint/schematics": "^15.0.0",
    "@angular-eslint/template-parser": "^15.0.0",
    "@angular/cli": "^15.0.0",
    "@angular/compiler": "^15.0.0",
    "@angular/compiler-cli": "^15.0.0",
    "@angular/language-service": "^15.0.0",
    "@capacitor/cli": "4.7.1",
    "@ionic/angular-toolkit": "^8.0.0",
    "@types/jasmine": "~4.0.0",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "5.3.0",
    "@typescript-eslint/parser": "5.3.0",
    "cordova-android": "^10.1.2",
    "cordova-ios": "^6.2.0",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-x-socialsharing": "^6.0.4",
    "es6-promise-plugin": "^4.2.2",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "jasmine-core": "~4.3.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.8.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {}
    }
  }
}
cordova ionic-framework rxjs dependencies ionic-native
© www.soinside.com 2019 - 2024. All rights reserved.