Search code examples
node.jsangularangular-cliversion

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. I have updated Node.js version to v10.23.1. Here are the installed versions on my computer.

Angular CLI: 11.2.2 Node: 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.


Solution

  • 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).

    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.

    nvm install 10
    nvm install 12
    nvm use 10
    

    Be sure you have the Angular CLI updated globally by running:

    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.