Sunday, August 19, 2018

Error in angular2 cli installation

I am installing angular2 in linux with

sudo npm install -g @angular/cli

and after running that it successifully installs but after typing

ng new mynewapp

Am getting an error

/usr/local/lib/node_modules/@angular/cli/models/config/config.js:16
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. (/usr/local/lib/node_modules/@angular/cli/models/config.js:3:18)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)  

what could be wrong

Solved

It's seem your nodejs version does not support ES2015, update your node to version 6+

you can using nvm to manage your node version


Your need Node version 6.x or higher See documentation below

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


No comments:

Post a Comment