在 Angular 中安装 Bootstrap(Ngb 模块)时出错

1 node.js angular bootstrap-5

我想在 Angular 中安装 Ngb。\n我使用 n Node.js 版本 v19.1.0。我已经尝试过 --force 和 --legacy-pear-drops。我也尝试重新安装 Node.js。

\n

日志:\n `npm ERR! code ERESOLVE\n npm ERR! ERESOLVE could not resolve\n npm ERR!\n npm ERR! While resolving: markb@0.0.0\ npm ERR! Found: @angular/core@14.2.2n npm ERR! node_modules/@angular/core\n \n\n npm ERR! peer @angular/core@"14.2.2" from @angular/animations@14.2.2\ n \n \n\ n\ n \ n\ n\n \ n\n \n\ n\ n\ n\n \ n \n \n \n \n \n \ n \n\n \ n \ n\ n\n \n \ n\n \n\ n\n \n \n \n \nnpm ERR! node_modules/@angular/animationsnpm ERR! peerOptional @angular/animations@"14.2.2" from @angular/platform-browser@14.2.2npm ERR! node_modules/@angular/platform-browsernpm ERR! peer @angular/platform-browser@"14.2.2" from @angular/forms@14.2.2npm ERR! node_modules/@angular/formsnpm ERR! @angular/forms@"^14.1.0" from the root projectnpm ERR! 3 more (@angular/platform-browser-dynamic, @angular/router, the root project)npm ERR! @angular/animations@"^14.1.0" from the root projectnpm ERR! peer @angular/core@"14.2.2" from @angular/common@14.2.2npm ERR! node_modules/@angular/commonnpm ERR! peer @angular/common@"14.2.2" from @angular/forms@14.2.2npm ERR! node_modules/@angular/formsnpm ERR! @angular/forms@"^14.1.0" from the root projectnpm ERR! peer @angular/common@"14.2.2" from @angular/platform-browser@14.2.2npm ERR! node_modules/@angular/platform-browsernpm ERR! peer @angular/platform-browser@"14.2.2" from @angular/forms@14.2.2npm ERR! node_modules/@angular/formsnpm ERR! @angular/forms@"^14.1.0" from the root projectnpm 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! 6 more (@angular/compiler, @angular/forms, ...)npm ERR!npm ERR! Could not resolve dependency:npm ERR! @ng-bootstrap/ng-bootstrap@"13.1.1" from the root projectnpm ERR!npm ERR! Conflicting peer dependency: @angular/core@14.2.12npm ERR! node_modules/@angular/corenpm ERR! peer @angular/core@"14.2.12" from @angular/forms@14.2.12npm ERR! node_modules/@angular/formsnpm ERR! @angular/forms@"^14.1.0" from the root projectnpm ERR! peer @angular/forms@"^14.1.0" from @ng-bootstrap/ng-bootstrap@13.1.1npm ERR! node_modules/@ng-bootstrap/ng-bootstrapnpm ERR! @ng-bootstrap/ng-bootstrap@"13.1.1" from the root projectnpm ERR!npm ERR! Fix the upstream dependency conflict, or retrynpm ERR! this command with --force, or --legacy-peer-depsnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.npm ERR!npm ERR! See C:\\Users\\thomas\\AppData\\Local\\npm-cache\\eresolve-report.txt for a full report.

\n

npm ERR! A complete log of this run can be found in:\n npm ERR! C:\\Users\\thomas\\AppData\\Local\\npm-cache_logs\\2022-11-24T10_07_23_103Z-debug-0.log\n\xc3\x97 Packages installation failed, see above.`

\n

我期望安装 Bootstrap

\n

小智 5

第一次尝试npm config set legacy-peer-deps true。也许您还必须运行npm audit fix See Also Angular Bootstrap is Getting Error on Angular 13 Project