angular - 为什么 ng new app 安装了早于 12 的版本(现在是最新的)
问题描述
尝试创建一个角度应用程序,我不明白如何使用版本 12 而不是版本 8。是的,...因为ng new app
实际上是在版本 8 中创建应用程序。
版本
这是 的输出ng version
。当前的角度版本是Angular: 8.2.14
,但我会创建一个带有版本的应用程序12.*
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.3.29
Node: 14.17.3
OS: darwin x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.29
@angular-devkit/build-angular 0.803.29
@angular-devkit/build-optimizer 0.803.29
@angular-devkit/build-webpack 0.803.29
@angular-devkit/core 8.3.29
@angular-devkit/schematics 8.3.29
@angular/cli 8.3.29
@ngtools/webpack 8.3.29
@schematics/angular 8.3.29
@schematics/update 0.803.29
rxjs 6.4.0
typescript 3.5.3
webpack 4.39.2
ng 更新@angular/cli@9
命令失败:
The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Using package manager: 'npm'
Collecting installed dependencies...
Found 33 dependencies.
Fetching dependency metadata from registry...
Package "@angular-devkit/build-angular" has an incompatible peer dependency to "@angular/compiler-cli" (requires ">=9.0.0 < 10", would install "13.0.0-next.15")
Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.6 < 3.9", would install "4.4.3")
✖ Migration failed: Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.
See "/private/var/folders/45/63w301n97l3d90j_5n39_kpr0000gn/T/ng-h5yjfi/angular-errors.log" for further details.
?
如何创建 angular12 应用程序?
解决方案
而不是ng new <my-project>
你可以使用
npx @angular/cli@12 new <my-project>
这将创建@angular/cli
带有12.x.x
版本的应用程序。
其他选项:
npx @angular/cli new <my-project>
- 最新版本
npx @angular/cli@12.2.2 new <my-project>
- 12.2.2 版本
推荐阅读
- wpf - 防止焦点/标签进入 UI 中的不可见元素
- python - 如何将 A 星算法的公式修改为我需要的以下内容?
- php - 数组中的 if 语句
- javascript - 使用momentjs获取用户选择的偏移值?
- python - 读取csv属性时Python字符串替换不起作用
- java - JPA,EclipseLink @Version +时间戳+精度?
- alexa - 我可以在没有 AWS lambda 的情况下使用 Alexa 技能提醒 API 和主动事件 API 吗?
- reactjs - 使用 react-redux translate 函数时,渲染的钩子比预期的要少
- swift - 你能挑选和选择在 Swift 的子类中继承的内容吗?
- javascript - filecleared of fileinput 删除