首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法安装正确的Angular/CLI版本

无法安装正确的Angular/CLI版本
EN

Stack Overflow用户
提问于 2021-06-29 23:55:45
回答 2查看 2.6K关注 0票数 1

我正在尝试在macos上安装nodejs 10.x版,以及angular cli。但每次尝试时,我都会得到有关ng与node版本不兼容的错误。

我一直在关注这里的帖子Unable to get Angular CLI version, though all the requirements are installed?

我在安装过程中没有收到任何错误,但我一直收到以下错误:

代码语言:javascript
运行
复制
adminMini:client admin$ ng -v
Node.js version v10.24.1 detected.
The Angular CLI requires a minimum Node.js version of either v12.14 or v14.15.

Please update your Node.js version or visit https://nodejs.org/ for additional instructions.

下面是我安装angular的方法:

代码语言:javascript
运行
复制
adminMini:client admin$ nvm use 10
Now using node v10.24.1 (npm v6.14.12)

adminMini:client admin$ npm uninstall -g @angular/cli
removed 235 packages in 2.001s

adminMini:client admin$ nvm use 10
Now using node v10.24.1 (npm v6.14.12)
adminMini:client admin$ npm install -g @angular/cli
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
/Users/admin/.nvm/versions/node/v10.24.1/bin/ng -> /Users/admin/.nvm/versions/node/v10.24.1/lib/node_modules/@angular/cli/bin/ng

> @angular/cli@12.1.0 postinstall /Users/admin/.nvm/versions/node/v10.24.1/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js

npm WARN notsup Unsupported engine for @angular/cli@12.1.0: wanted: {"node":"^12.14.1 || >=14.0.0","npm":"^6.11.0 || ^7.5.6","yarn":">= 1.13.0"} (current: {"node":"10.24.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: @angular/cli@12.1.0
npm WARN notsup Unsupported engine for @angular-devkit/architect@0.1201.0: wanted: {"node":"^12.14.1 || >=14.0.0","npm":"^6.11.0 || ^7.5.6","yarn":">= 1.13.0"} (current: {"node":"10.24.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: @angular-devkit/architect@0.1201.0
npm WARN notsup Unsupported engine for @angular-devkit/core@12.1.0: wanted: {"node":"^12.14.1 || >=14.0.0","npm":"^6.11.0 || ^7.5.6","yarn":">= 1.13.0"} (current: {"node":"10.24.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: @angular-devkit/core@12.1.0
npm WARN notsup Unsupported engine for @angular-devkit/schematics@12.1.0: wanted: {"node":"^12.14.1 || >=14.0.0","npm":"^6.11.0 || ^7.5.6","yarn":">= 1.13.0"} (current: {"node":"10.24.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: @angular-devkit/schematics@12.1.0
npm WARN notsup Unsupported engine for @schematics/angular@12.1.0: wanted: {"node":"^12.14.1 || >=14.0.0","npm":"^6.11.0 || ^7.5.6","yarn":">= 1.13.0"} (current: {"node":"10.24.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: @schematics/angular@12.1.0
npm WARN notsup Unsupported engine for open@8.2.1: wanted: {"node":">=12"} (current: {"node":"10.24.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: open@8.2.1

+ @angular/cli@12.1.0
added 235 packages from 180 contributors in 7.702s

任何建议都将不胜感激。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-06-30 00:10:54

使用命令npm install -g @angular/cli时,您将安装最新版本的angular,它需要Node12版本。

因此,您需要将节点版本更新为12,或者通过向安装脚本指明版本来安装以前版本的angular

代码语言:javascript
运行
复制
npm -g install @angular/cli@8.3.25
票数 2
EN

Stack Overflow用户

发布于 2021-06-30 00:35:20

您已经在使用nvm,请尝试使用nvm安装节点的最新版本,如下所示:

代码语言:javascript
运行
复制
nvm install --lts

检查应高于12的最新nvm版本。原因是angular版本8依赖于较低版本的node不能很好地运行。此外,还建议保持版本更新,以防止安全漏洞。

这将列出版本,选择版本v12.14 or v14.15LTS

代码语言:javascript
运行
复制
nvm list
.....
nvm use v12.14

之后,使用此link安装angular版本的8+。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68182090

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档