我无法安装角度谷歌地图到我的Ionic角项目。我试着运行命令npm install @agm/core --save
,但是我得到了以下错误:
code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: MyProgram@0.0.1
npm ERR! Found: @angular/common@11.2.14
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"~11.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^9.1.0 || ^10.0.0" from @agm/core@3.0.0-beta.0
npm ERR! node_modules/@agm/core
npm ERR! @agm/core@"*" from 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使用的是11.2版本.
dependencies": {
"@angular/animations": "~11.2.0",
"@angular/cdk": "^11.2.2",
"@angular/common": "~11.2.0",
"@angular/core": "~11.2.0",
"@angular/forms": "~11.2.0",
"@angular/material": "^11.2.2",
"@angular/platform-browser": "~11.2.0",
"@angular/platform-browser-dynamic": "~11.2.0",
"@angular/router": "~11.2.0",
"@capacitor/android": "^2.4.6",
"@capacitor/core": "2.4.6",
"@ionic-native/core": "^5.31.1",
"@ionic-native/photo-viewer": "^5.31.1",
"@ionic/angular": "^5.5.2",
"capacitor-video-player": "^2.4.5-2",
"com-sarriaroman-photoviewer": "^1.2.5",
"cordova-plugin-geolocation": "^4.1.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
我尝试运行ng update @angular/cli @angular/core
,这将导致以下输出:
Node.js version v15.5.1 detected.
Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
✔ Package successfully installed.
Node.js version v15.5.1 detected.
The Angular CLI requires a minimum Node.js version of either v12.20, v14.15, or v16.10.
但是,如果我尝试使用NVM将我的节点版本设置为16,ng
突然就不作为命令存在了。
发布于 2022-03-29 17:58:35
您有依赖冲突(不正确的和可能中断的依赖关系),因此尝试使用--legacy-peer-deps. (-force)运行该命令。如果它不生效,临时解决方案是使用Node.js的早期版本(降级Node.js版本),因为它有时会导致此类错误发生。
https://stackoverflow.com/questions/71666735
复制相似问题