Angular: 示意图工作流失败。看上面

Angular: The Schematic workflow failed. See above

CREATE firstapp/package.json (1209 bytes)
CREATE firstapp/README.md (1018 bytes)
CREATE firstapp/tsconfig.json (783 bytes)
CREATE firstapp/tslint.json (3185 bytes)
CREATE firstapp/.editorconfig (274 bytes)
CREATE firstapp/.gitignore (631 bytes)
CREATE firstapp/.browserslistrc (703 bytes)
CREATE firstapp/karma.conf.js (1425 bytes)
CREATE firstapp/tsconfig.app.json (287 bytes)
CREATE firstapp/tsconfig.spec.json (333 bytes)
CREATE firstapp/src/favicon.ico (948 bytes)
CREATE firstapp/src/index.html (294 bytes)
CREATE firstapp/src/main.ts (372 bytes)
CREATE firstapp/src/polyfills.ts (2830 bytes)
CREATE firstapp/src/styles.css (80 bytes)
CREATE firstapp/src/test.ts (753 bytes)
CREATE firstapp/src/assets/.gitkeep (0 bytes)
CREATE firstapp/src/environments/environment.prod.ts (51 bytes)
CREATE firstapp/src/environments/environment.ts (662 bytes)
CREATE firstapp/src/app/app-routing.module.ts (245 bytes)
CREATE firstapp/src/app/app.module.ts (393 bytes)
CREATE firstapp/src/app/app.component.html (24955 bytes)
CREATE firstapp/src/app/app.component.spec.ts (1063 bytes)
CREATE firstapp/src/app/app.component.ts (212 bytes)
CREATE firstapp/src/app/app.component.css (0 bytes)
CREATE firstapp/e2e/protractor.conf.js (904 bytes)
CREATE firstapp/e2e/tsconfig.json (274 bytes)
CREATE firstapp/e2e/src/app.e2e-spec.ts (659 bytes)
CREATE firstapp/e2e/src/app.po.ts (274 bytes)
| Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: firstapp@0.0.0
npm ERR! Found: jasmine-core@3.6.0
npm ERR! node_modules/jasmine-core
npm ERR!   dev jasmine-core@"~3.6.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core@">=3.7.1" from karma-jasmine-html-reporter@1.6.0
npm ERR! node_modules/karma-jasmine-html-reporter
npm ERR!   dev karma-jasmine-html-reporter@"^1.5.0" 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.
npm ERR!
npm ERR! See C:\Users\vishn\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\vishn\AppData\Local\npm-cache\_logs21-05-10T00_27_07_509Z-debug.log
× Package install failed, see above.
The Schematic workflow failed. See above.
Angular CLI: 11.2.12
Node: 16.1.0
OS: win32 x64

Angular: <error>
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.12 (cli-only)
@angular-devkit/build-angular   <error>
@angular-devkit/core            11.2.12 (cli-only)
@angular-devkit/schematics      11.2.12 (cli-only)
@angular/cli                    11.2.12 (cli-only)
@schematics/angular             11.2.12 (cli-only)
@schematics/update              0.1102.12 (cli-only)
rxjs                            6.6.3 (cli-only)
typescript                      <error>

我试图创建新的 Angular 项目,但遇到了这个错误。我在这里粘贴了我的错误和 angular 的版本及其使用的依赖项(ng 版本)。我使用安装程序安装 Node.js,使用 cmd 命令安装 angular cli。但是我无法创建新项目(ng new project-name)请帮我解决这个问题。提前致谢

这是一些过时包在 angular-cli 中的错误,已在 github 的存储库中解决,但尚未发布到 npmjs,您可以解决有两种方式:

  1. 安装包时使用“--legacy-peer-deps --force”
  2. https://github.com/angular/angular-cli/commit/b34ed5c4007f9ef08b370219081b4d23f9f24fb8
  3. 中的最新提交一样在“jasmine”更新 package.json

这是 angular-cli github repo https://github.com/angular/angular-cli/issues/20719

上此错误的未决问题

您还可以使用 npm install -g npm@6 将 npm 从 7 降级到 6 来解决这个问题

如果您在安装过程中遇到其他问题,请删除 npm 和 npm-cache in: \AppData\Roaming 然后重试

检查,是同一个问题。

Open the folder you create with ng new and open the package.json file. In devDependencies change the version of "jasmine-core" 3.6.0 to 3.7.1 and "karma-jasmine-html-reporter" from 1.5.0 to 1.6.0 and save it. Than go back to Terminal and go to your project and run npm install. Now it works und you can run ng serve.

更新或新安装@angular/cli

npm install -g @angular/cli

我遇到了类似的错误,所以我选择了一个使用 n 库的较新节点版本,如下所示:https://nkaushik.com/nodejs/nodejs-version-manager-n/

然后我更新了我的 angular 版本:

install -g @angular/cli

哦,别忘了关闭你的 VPN

解决方法

启动新的 Angular 项目有一个解决方法:

ng new project --skip-install

cd project

npm install(或者如果失败 npm install --force

我在 angular-cli github repo 上的这个错误的未解决问题的评论中发现了这一点,Ammar M Mashfj 在他们的回答中链接到: https://github.com/angular/angular-cli/issues/20719#issuecomment-835810313