[英]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.