【问题标题】:How to create a new application with `ng new`?如何使用 `ng new` 创建新应用程序?
【发布时间】:2019-06-01 02:56:27
【问题描述】:

我使用的是节点 v10.16.0,但每次我尝试运行“ng new”或“ng -v”时都会收到一条错误消息,提示我正在运行 V6.11.3,并且我应该使用 10.9 或更高版本。

我尝试使用“npm cache clean”清理缓存。我试图卸载并重新安装 angular 和 node。我检查了系统变量并添加了路径。

C:\Users\Yv-Arnel\code>node -v
v10.16.0

C:\Users\Yv-Arnel\code>ng -v
You are running version v6.11.3 of Node.js, which is not supported by Angular CLI 8.0+.
The official Node.js version that is supported is 10.9 or greater.

Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.

【问题讨论】:

  • 在您拥有早期版本的 Node 时是否安装了 CLI?您是否再次尝试npm install -g @angular/cli
  • 这怎么可能node -v v10.16.0 但错误显示You are running version v6.11.3 of Node.js 你安装了2 个node.js 吗?
  • 您使用的是 Windows。转到您的控制面板并卸载 NodeJS。从 PATH 环境变量中删除它,然后访问他们的网站并安装 LTS 版本。
  • 您需要 node.js v12(不是 LTS)来运行 angular v8(最新)

标签: node.js angular npm angular-cli


【解决方案1】:

有一个使用 Laragon 安装的节点版本

我在一年前使用 Laragon,并使用 Laragon 安装了 node.js。 我使用控制面板卸载节点但我仍然能够运行“node -v”,因为安装了两个版本。所以我查找了 Laragon 安装它的目录,然后将其删除,然后我在其上安装了最新版本的 node aivalaible网站,我能够运行“ng new”。

【讨论】:

    猜你喜欢
    • 2019-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-19
    • 1970-01-01
    • 1970-01-01
    • 2021-10-09
    • 1970-01-01
    相关资源
    最近更新 更多