Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng new my-app unexpected token =

I have installed the angular2 cli via npm, but when I try to create a new typescript angular app with the command 'ng new my-app' I keep getting this error:

C:\Users\nicholas\AppData\Roaming\npm\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:373:25)     at Object.Module._extensions..js (module.js:416:10)     at Module.load (module.js:343:32)     at Function.Module._load (module.js:300:12)     at Module.require (module.js:353:17)     at require (internal/module.js:12:17)     at Object.<anonymous> (C:\Users\nicholas\AppData\Roaming\npm\node_modules\@angular\cli\models\config.js:2:18)     at Module._compile (module.js:409:26)     at Object.Module._extensions..js (module.js:416:10) 

My NPM version is 4.1.2 My node version is 4.4.5 which from my understanding are acceptable versions for installing and using the angular-cli.

Please let me know if there is a fix to this, I have also tried uninstalling, cleaning npm cache and reinstalling but I keep getting the same issue.

Any and all help is very appreciated, thanks in advance!

like image 771
Nicholas Pesa Avatar asked Feb 10 '17 18:02

Nicholas Pesa


1 Answers

If you have installed @angular/cli, you need NodeJS higher 6.9.7, together with NPM 3 or higher.

If you have installed angular-cli, you need NodeJS higher than 4.4.x, together with NPM 3 or higher.

For more see the links above and read the prerequisites.

like image 92
Suren Srapyan Avatar answered Nov 08 '22 19:11

Suren Srapyan