本文介绍了运行 ng new 命令时出现 jasmine 版本错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行 ng new 命令时出错在 ng new Project-Name-Here 期间触发以下错误

I am getting error while running ng new commandbelow error is fired during the ng new Project-Name-Here

无法解析依赖:错误对等 jasmine-core@>=3.7.1";来自 [email protected]

Could not resolve dependency:error peer jasmine-core@">=3.7.1" from [email protected]

silly fetch manifest jasmine-core@>=3.7.1
83 timing idealTree Completed in 8839ms
84 timing command:install Completed in 8849ms
85 verbose stack Error: unable to resolve dependency tree
85 verbose stack     at Arborist.[failPeerConflict] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1141:25)
85 verbose stack     at Arborist.[loadPeerSet] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1118:34)
85 verbose stack     at async Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:836:11)
85 verbose stack     at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:209:7)
85 verbose stack     at async Promise.all (index 1)
85 verbose stack     at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:130:5)
85 verbose stack     at async install (C:\Program Files\nodejs\node_modules\npm\lib\install.js:38:3)
86 verbose cwd C:\Users\PYH0JFQ\source\Hospital\Patient
87 verbose Windows_NT 10.0.19041
88 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
89 verbose node v15.11.0
90 verbose npm  v7.6.0
91 error code ERESOLVE
92 error ERESOLVE unable to resolve dependency tree
93 error
94 error While resolving: [email protected]
94 error Found: [email protected]
94 error node_modules/jasmine-core
94 error   dev jasmine-core@"~3.6.0" from the root project
94 error
94 error Could not resolve dependency:
94 error peer jasmine-core@">=3.7.1" from [email protected]
94 error node_modules/karma-jasmine-html-reporter
94 error   dev karma-jasmine-html-reporter@"^1.5.0" from the root project
94 error
94 error Fix the upstream dependency conflict, or retry
94 error this command with --force, or --legacy-peer-deps
94 error to accept an incorrect (and potentially broken) dependency resolution.

推荐答案

我最近遇到了同样的问题,我是从在线讲师那里了解到的.无论如何,你应该清楚地表达这个问题

I have faced the same issue recently and i got to know this from an online instructor.you should have phrase the question neatly, anyways

此错误是由 npm 7 问题引起的.Angular 团队建议暂时使用 npm 6.所以暂时将 npm 7 降级到 npm 6

This error is caused by an npm 7 issue. The Angular team recommends to use npm 6 for now.so downgrade the npm 7 to npm 6 for now

npm install -g npm@6

另一种方法是使用 --skipInstall 标志运行 ng new,然后使用 npm install --legacy-peer-deps 安装依赖项.

An alternative can be to run ng new with the --skipInstall flag, and then install the dependencies with npm install --legacy-peer-deps.

这篇关于运行 ng new 命令时出现 jasmine 版本错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 08:33