23

My angular-cli version was beta.16

I try to update by following command

npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli@latest

after succesfully install when i try to run any ng command

ng version 
ng help

I am getting this error

ng help
/usr/local/lib/node_modules/@angular/cli/models/config/config.js:15
    constructor(_configPath, schema, configJson, fallbacks = []) {
                                                           ^

SyntaxError: Unexpected token =
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/models/config.js:2:18)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)

2 Answers 2

37

You need Node version 6.x or higher

take a look here: https://github.com/angular/angular-cli/issues/4604

Sign up to request clarification or add additional context in comments.

2 Comments

Yeah, that was it for me - my CI server was pulling in a Node 5:10:0 docker image... switching to 7.5.0 fixed it
Argh, so the documentation at angular.io/docs/ts/latest/cli-quickstart.html incorrectly states that 4.x.x is good enough. Wonderful.
2

As mentioned, you need Node version 6.x or higher.

Quick solution posted on Github by cdvillagra:

npm cache clean -f
npm install -g n
n stable

(you might need to prefix those commands with sudo).

Also, on Ubuntu or similar you may want to remove your old version of node and then link the new one:

sudo ln -s /usr/local/bin/node /usr/bin/node

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.