如何为节点安装 angular cli

How to install angular cli for node

我正在尝试安装 angular cli,但我收到的消息低于此消息。我如何为 nodejs 安装特定的 angular cli 版本 v6.x.x.which angular cli verion 适用于 nodsjs v6.x.x?

You are running version v6.x.x of node.js, which is not supported by angular CLI v6. The official Node.js version that is supported is 8.x and greater.

您必须在 package.json 文件中调整 angular-cli 的版本。 angular-cli 应该有一个条目。看看下面的图片。在 devDependencies 下,您可以看到带有版本的 @angular/cli。更改此版本并再次调用 npm install

package.json 位于您 angular 项目的根目录中。它是在您执行 npm init 时自动生成的。

我认为与 node 6.9.x 兼容的最后一个版本是 @angular/cli@6.0.8 检查 this 所有版本

npm uninstall -g @angular/cli
npm cache clean --force
npm install -g @angular/cli@6.0.8

如果您想在系统上安装最新版本的 Node,您可以升级或卸载当前的 Node 版本,然后在官方 Node 站点下载并安装 - https://nodejs.org/en/download/

要检查当前安装的节点版本,请使用

1. Window key+ r -> opens run window
2. Type cmd press enter.
3. Type node -v to check the currently installed node version.
4. Type npm -v to check currently installed npm version.
5. Your primary problem was to install angular/cli
so  use command npm install -g @angular/cli this will install angular/cli globally.