创建离子应用程序时无法解析依赖树
Posted
技术标签:
【中文标题】创建离子应用程序时无法解析依赖树【英文标题】:unable to resolve dependency tree when create ionic app 【发布时间】:2021-08-11 20:08:01 【问题描述】:您好,当我想创建一个 ionic 应用程序时,我收到了无法修复的错误:
npm 错误!代码 ERESOLVE npm 错误! ERESOLVE 无法解析依赖树 npm 错误!
npm ERR! Found: postcss@8.2.14
npm ERR! node_modules/postcss
npm ERR! postcss@"8.2.14" from @angular-devkit/build-angular@0.1102.13
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~0.1102.4" from the root project
npm ERR! peer @angular-devkit/build-angular@"^0.1102.4" from @ionic/angular-toolkit@3.1.1
npm ERR! node_modules/@ionic/angular-toolkit
npm ERR! dev @ionic/angular-toolkit@"^3.1.1" from the root project
npm ERR! peer postcss@"^8.1.0" from autoprefixer@10.2.4
npm ERR! node_modules/autoprefixer
npm ERR! autoprefixer@"10.2.4" from @angular-devkit/build-angular@0.1102.13
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~0.1102.4" from the root project
npm ERR! 1 more (@ionic/angular-toolkit)
npm ERR! 9 more (css-loader, cssnano, postcss-import, postcss-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer postcss@"^8.2.15" from cssnano-preset-default@5.1.1
npm ERR! node_modules/cssnano/node_modules/cssnano-preset-default
npm ERR! cssnano-preset-default@"^5.0.1" from cssnano@5.0.2
npm ERR! node_modules/cssnano
npm ERR! cssnano@"5.0.2" from @angular-devkit/build-angular@0.1102.13
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~0.1102.4" from the root project
npm ERR! 1 more (@ionic/angular-toolkit)
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.
[ERROR] An error occurred while running subprocess npm.
npm.cmd i exited with exit code 1.
我检查了很多方法,但无法解决。 请帮帮我
【问题讨论】:
你的node和npm是什么版本 看看这个:***.com/questions/67625297/… 【参考方案1】:使用这个命令:
npm install --save --legacy-peer-deps
【讨论】:
以上是关于创建离子应用程序时无法解析依赖树的主要内容,如果未能解决你的问题,请参考以下文章