拨开荷叶行,寻梦已然成。仙女莲花里,翩翩白鹭情。
IMG-LOGO
主页 文章列表 尝试在Angular中安装Clarity库,“ngadd@clr/angular”出现错误“ERESOLVE无法决议依赖树”

尝试在Angular中安装Clarity库,“ngadd@clr/angular”出现错误“ERESOLVE无法决议依赖树”

白鹭 - 2022-02-02 2145 0 0

我正在按照一个书籍项目练习 Angular,该项目需要通过 cmd 为该项目安装 Clarity 库,ng add @clr/angular但我不断收到与不兼容性相关的错误(报告):

0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'install',
0 verbose cli   '@clr/angular@12.0.8',
0 verbose cli   '--quiet'
0 verbose cli ]
1 info using npm@8.1.0
2 info using node@v16.13.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:C:\Users\muril\Desktop\Angular\Angular-Projects-Second-Edition-main\issue-tracker\.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:C:\Users\muril\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\muril\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 12ms
19 timing npm:load:configload Completed in 12ms
20 timing npm:load:setTitle Completed in 1ms
21 timing npm:load:setupLog Completed in 0ms
22 timing config:load:flatten Completed in 4ms
23 timing npm:load:cleanupLog Completed in 2ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 1ms
26 timing npm:load Completed in 20ms
27 timing arborist:ctor Completed in 1ms
28 timing idealTree:init Completed in 620ms
29 timing idealTree:userRequests Completed in 4ms
30 silly idealTree buildDeps
31 silly fetch manifest @clr/angular@12.0.8
32 timing arborist:ctor Completed in 0ms
33 http fetch GET 200 https://registry.npmjs.org/@clr/angular 2111ms (cache revalidated)
34 silly fetch manifest @angular/common@~13.0.0
35 http fetch GET 200 https://registry.npmjs.org/@angular/common 1464ms (cache revalidated)
36 silly fetch manifest @angular/common@^12.0.0
37 silly fetch manifest @angular/core@~13.0.0
38 http fetch GET 200 https://registry.npmjs.org/@angular/core 1450ms (cache revalidated)
39 silly fetch manifest rxjs@~7.4.0
40 http fetch GET 200 https://registry.npmjs.org/rxjs 39ms (cache revalidated)
41 silly fetch manifest zone.js@~0.11.4
42 http fetch GET 200 https://registry.npmjs.org/zone.js 752ms (cache revalidated)
43 timing idealTree Completed in 6521ms
44 timing command:install Completed in 6535ms
45 verbose stack Error: unable to resolve dependency tree
45 verbose stack     at Arborist.[failPeerConflict] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1356:25)
45 verbose stack     at Arborist.[loadPeerSet] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1322:34)
45 verbose stack     at async Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:930:11)
45 verbose stack     at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:216:7)
45 verbose stack     at async Promise.all (index 1)
45 verbose stack     at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:149:5)
45 verbose stack     at async Install.install (C:\Program Files\nodejs\node_modules\npm\lib\install.js:170:5)
46 verbose cwd C:\Users\muril\Desktop\Angular\Angular-Projects-Second-Edition-main\issue-tracker
47 verbose Windows_NT 10.0.19042
48 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "@clr/angular@12.0.8" "--quiet"
49 verbose node v16.13.0
50 verbose npm  v8.1.0
51 error code ERESOLVE
52 error ERESOLVE unable to resolve dependency tree
53 error
54 error While resolving: issue-tracker@0.0.0
54 error Found: @angular/common@13.0.3
54 error node_modules/@angular/common
54 error   @angular/common@"~13.0.0" from the root project
54 error
54 error Could not resolve dependency:
54 error peer @angular/common@"^12.0.0" from @clr/angular@12.0.8
54 error node_modules/@clr/angular
54 error   @clr/angular@"12.0.8" from the root project
54 error
54 error Fix the upstream dependency conflict, or retry
54 error this command with --force, or --legacy-peer-deps
54 error to accept an incorrect (and potentially broken) dependency resolution.
54 error
54 error See C:\Users\muril\AppData\Local\npm-cache\eresolve-report.txt for a full report.
55 verbose exit 1

我尝试指定清晰度版本 (@clr/angular@12) 并使用该命令--force,但它们都导致了相同的错误。网上似乎有很多关于 npm cache 的帖子,但他们对什么是合适的解决方案的看法各不相同,这让我害怕仅仅尝试就会让事情变得更糟。

你能帮忙吗?

uj5u.com热心网友回复:

您的应用程序(或 angular 的)的某些依赖项未完全升级以与 npm 8.x 一起使用(更具体地说是与新版本的 package.json 结构)

尝试

npm  i @clr/angular --legacy-peer-deps

降级到 npm 7.x 也应该有效。

标签:

0 评论

发表评论

您的电子邮件地址不会被公开。 必填的字段已做标记 *