简体   繁体   English

无法构建 Angular - “检测到 Node.js 版本 v10.6.0。”

[英]Unable to build Angular - "Node.js version v10.6.0 detected."

I am trying to build an angular project which works with Node.js v10.23.1.我正在尝试构建一个与 Node.js v10.23.1 一起使用的 angular 项目。 I have updated Node.js version to v10.23.1.我已将 Node.js 版本更新到 v10.23.1。 Here are the installed versions on my computer.这是我电脑上安装的版本。

Angular CLI: 11.2.2 Node: 10.23.1 Angular CLI:11.2.2 节点:10.23.1

When the build command running, I am getting the error below:当构建命令运行时,我收到以下错误:

[13:56:20] Error in plugin "run-sequence(ng:build-angular)" Message:
    Command failed: cd XXX && ng build --deploy-url XXX Node.js version v10.6.0 detected. The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0. Please update your Node.js version or visit https://nodejs.org/ for additional instructions. Details:
    killed: false
    code: 3
    signal: null
    cmd: cd XXX && ng build --deploy-url XXX Stack: Error: Command failed: XXX && ng build --deploy-url XXX Node.js version v10.6.0 detected. The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0. Please update your Node.js version or visit https://nodejs.org/ for additional instructions.
    at ChildProcess.exithandler (child_process.js:291:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:961:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5) Process terminated with code 1.

Please advice.请指教。

There might be a problem with the Node.js installation, i advice you to remove Node.js from your computer and try to install it again with nvm ( Node Version Manager ). Node.js 安装可能存在问题,我建议您从计算机中删除 Node.js 并尝试使用 nvm(节点版本管理器)再次安装它。

This tool let you install multiple versions of Node.js and let you choose which one you want to use, for example in you case you may try install both version 10 and 12 and try to build/serve with those.此工具可让您安装 Node.js 的多个版本,并让您选择要使用的版本,例如,您可以尝试安装版本 10 和 12 并尝试使用它们构建/服务。

nvm install 10
nvm install 12
nvm use 10

Be sure you have the Angular CLI updated globally by running:确保通过运行以下命令全局更新 Angular CLI:

npm install @angular/cli -g

You can also try to delete node_modules folder under you project folder and run npm install to reinstall every npm package.您也可以尝试删除项目文件夹下的 node_modules 文件夹并运行npm install以重新安装每个 npm package。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 @bigcommerce/stencil-cli | Node v10.6.0 上的错误 - @bigcommerce/stencil-cli | Error on Node v10.6.0 docker 构建出现错误,检测到节点 v10,Angular CLI 需要 v12.14 或 v14.15 的最低 Node.js 版本 - docker build gives error, node v10 detected, The Angular CLI requires a minimum Node.js version of either v12.14 or v14.15 Docker“检测到未定义的 Node.js 版本” - Docker "Node.js version undefined detected" Node.js - 诊断“(节点)警告:检测到递归process.nextTick。” - Node.js - Diagnose “(node) warning: Recursive process.nextTick detected.” 检测到错误的 Node.js 版本 - Wrong Node.js version detected ng 构建失败并显示“您正在运行 Node.js 的 v8.11.3 版本,Angular CLI 8.0+ 不支持该版本。” - ng build fails with “You are running version v8.11.3 of Node.js, which is not supported by Angular CLI 8.0+.” 使用brew将节点版本10.7.0降级到10.6.0 - Downgrade node version 10.7.0 to 10.6.0 using brew '您正在运行 Node.js 的版本 ' + process.version + ',Angular CLI v6 不支持该版本 - 'You are running version ' + process.version + ' of Node.js, which is not supported by Angular CLI v6 Node.js API 服务器 - 无法构建 - Node.js API Server - Unable to build 更高版本的Python会构建Node.js吗? - Will a higher version of Python build Node.js?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM