angular - 使用 Angular 9 CLI 创建新项目时如何解决纱线问题?
问题描述
我尝试使用 Angular CLI 创建一个新项目,但出现此错误:
yarn is not recognized as internal or external command
这是控制台日志:
C:\Users\sabir>ng new hello-world
? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? CSS
CREATE hello-world/angular.json (3606 bytes)
CREATE hello-world/package.json (1287 bytes)
CREATE hello-world/README.md (1027 bytes)
CREATE hello-world/tsconfig.json (489 bytes)
CREATE hello-world/tslint.json (3125 bytes)
CREATE hello-world/.editorconfig (274 bytes)
CREATE hello-world/.gitignore (631 bytes)
CREATE hello-world/browserslist (429 bytes)
CREATE hello-world/karma.conf.js (1023 bytes)
CREATE hello-world/tsconfig.app.json (210 bytes)
CREATE hello-world/tsconfig.spec.json (270 bytes)
CREATE hello-world/src/favicon.ico (948 bytes)
CREATE hello-world/src/index.html (296 bytes)
CREATE hello-world/src/main.ts (372 bytes)
CREATE hello-world/src/polyfills.ts (2835 bytes)
CREATE hello-world/src/styles.css (80 bytes)
CREATE hello-world/src/test.ts (753 bytes)
CREATE hello-world/src/assets/.gitkeep (0 bytes)
CREATE hello-world/src/environments/environment.prod.ts (51 bytes)
CREATE hello-world/src/environments/environment.ts (662 bytes)
CREATE hello-world/src/app/app.module.ts (314 bytes)
CREATE hello-world/src/app/app.component.html (25725 bytes)
CREATE hello-world/src/app/app.component.spec.ts (957 bytes)
CREATE hello-world/src/app/app.component.ts (215 bytes)
CREATE hello-world/src/app/app.component.css (0 bytes)
CREATE hello-world/e2e/protractor.conf.js (808 bytes)
CREATE hello-world/e2e/tsconfig.json (214 bytes)
CREATE hello-world/e2e/src/app.e2e-spec.ts (644 bytes)`enter code here`
CREATE hello-world/e2e/src/app.po.ts (301 bytes)`enter code here`
Installing packages...'yarn' is not recognized as an internal or external command,
operable program or batch file.
× Package install failed, see above.
The Schematic workflow failed. See above.
解决方案
也许你在 angular/cli 中使用 yarn 激活了。试试这个并创建一个新项目:
ng config -g cli.packageManager npm
到时候这个问题就没有了。
推荐阅读
- javascript - Firebase 云函数:保存 TypeScript Map() - 如何?
- javascript - dygraphs 无法按预期工作,1.1.0 版确实可以使用 Waterfox 和 Safari,但不能使用 2.1.0 版
- .net - Nlog 用于使用 NLog API 将日志记录到 Application Insight 和表存储中
- ios - 我的 Swift MapKit 注释没有显示
- azure - azure - userinfo - 别名字段或获得额外 - Graph 1.0
- algorithm - 根据增长率排列渐近函数
- java - 了解 JaCoCo 覆盖率 XML 报告
- python - 我可以将输出打印到 jupyter 笔记本中的另一个单元格吗?
- sql - select 和 where 子句中派生列的雄辩总和
- python - Remaning filename.txt 为 txt 的第一行