Angular CLI 目前需要 npm 版本 6

use*_*478 5 angular-cli

我正在使用 angular ng new 命令来创建一个应用程序。

ng 新的角度你好世界。

得到以下错误。检测到 npm 版本 7.5.1。Angular CLI 当前需要 npm 版本 6。

请安装兼容版本以继续 ( npm install --global npm@6)。

知道它是什么吗?为什么需要安装 npm@6

小智 5

试试这个

npm install --global npm@6
Run Code Online (Sandbox Code Playgroud)

  • 这实际上是推荐的解决方案,直到问题在 npm 7 中解决为止,如 https://github.com/angular/angular-cli/issues/19957 中所述 (4认同)

Raf*_*eto 3

您可以使用与 npm 6 兼容的最新 Node.js 版本来解决此问题:Node.js 14.15.Z

使用nvm(Mac 或 Linux)或nvm windows(仅限 Windows)来管理计算机中的多个 Node.js 版本。