Reputation: 16367
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)
Upvotes: 23
Views: 12715
Reputation: 61994
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
Upvotes: 2
Reputation: 9753
You need Node version 6.x or higher
take a look here: https://github.com/angular/angular-cli/issues/4604
Upvotes: 37