gpt4 book ai didi

angular-cli - 创建新的 Angular 项目时出现 npm 依赖错误

转载 作者:行者123 更新时间:2023-12-04 14:09:00 29 4
gpt4 key购买 nike

今天我决定进入框架并选择 Angular 作为开始。我正在使用 Node 和 npm,我以前从未使用过它们。我不是编程本身的菜鸟,但这对我来说是新的。
现在,当我尝试创建一个名为“banking-app”的新 Angular 项目时,我在节点中得到以下输出:

ng new banking-app
? Do you want to enforce stricter type checking and stricter bundle budgets in the workspace?
This setting helps improve maintainability and catch bugs ahead of time.
For more information, see https://angular.io/strict No
? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? CSS
CREATE banking-app/angular.json (3575 bytes)
CREATE banking-app/package.json (1201 bytes)
CREATE banking-app/README.md (1019 bytes)
CREATE banking-app/tsconfig.json (538 bytes)
CREATE banking-app/tslint.json (3185 bytes)
CREATE banking-app/.editorconfig (274 bytes)
CREATE banking-app/.gitignore (631 bytes)
CREATE banking-app/.browserslistrc (703 bytes)
CREATE banking-app/karma.conf.js (1428 bytes)
CREATE banking-app/tsconfig.app.json (287 bytes)
CREATE banking-app/tsconfig.spec.json (333 bytes)
CREATE banking-app/src/favicon.ico (948 bytes)
CREATE banking-app/src/index.html (296 bytes)
CREATE banking-app/src/main.ts (372 bytes)
CREATE banking-app/src/polyfills.ts (2830 bytes)
CREATE banking-app/src/styles.css (80 bytes)
CREATE banking-app/src/test.ts (753 bytes)
CREATE banking-app/src/assets/.gitkeep (0 bytes)
CREATE banking-app/src/environments/environment.prod.ts (51 bytes)
CREATE banking-app/src/environments/environment.ts (662 bytes)
CREATE banking-app/src/app/app.module.ts (314 bytes)
CREATE banking-app/src/app/app.component.html (25725 bytes)
CREATE banking-app/src/app/app.component.spec.ts (955 bytes)
CREATE banking-app/src/app/app.component.ts (215 bytes)
CREATE banking-app/src/app/app.component.css (0 bytes)
CREATE banking-app/e2e/protractor.conf.js (904 bytes)
CREATE banking-app/e2e/tsconfig.json (274 bytes)
CREATE banking-app/e2e/src/app.e2e-spec.ts (662 bytes)
CREATE banking-app/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: banking-app@0.0.0
npm ERR! Found: typescript@4.1.3
npm ERR! node_modules/typescript
npm ERR! dev typescript@"~4.1.2" from the root project
npm ERR! peer typescript@"~4.0.0 || ~4.1.0" from @angular-devkit/build-angular@0.1101.2
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~0.1101.2" from the root project
npm ERR! 2 more (@angular/compiler-cli, ng-packagr)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@"~3.9.5" from tsickle@0.39.1
npm ERR! node_modules/tsickle
npm ERR! peerOptional tsickle@"~0.39.0" from ng-packagr@11.1.3
npm ERR! node_modules/ng-packagr
npm ERR! peerOptional ng-packagr@"^11.0.0 || ^11.1.0-next" from @angular-devkit/build-angular@0.1101.2
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~0.1101.2" 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\xyz\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\xyz\AppData\Local\npm-cache\_logs\2021-02-03T14_27_21_486Z-debug.log
× Package install failed, see above.
The Schematic workflow failed. See above.
我对什么是依赖错误有一个大致的了解,但在这种情况下如何管理它却是零想法。我对 node、npm 等很陌生,所以我真的可以使用一些帮助来开始这个:|
提前致谢!

最佳答案

此错误出现在 7 版本的 npm(开发版)中。尝试使用 npm 的最后一个 LTS 版本,现在是 v6.14.11。要安装它,请在终端中运行命令 npm i npm@v6.14.11 -g

关于angular-cli - 创建新的 Angular 项目时出现 npm 依赖错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66029903/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com