Angular-cli: syntax error when running 'ng new' with [email protected]

Created on 7 Sep 2016  路  8Comments  路  Source: angular/angular-cli

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Windows 8
    node v4.1.1
    npm v3.8.7
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:

'ng --version' also throws same syntax error

  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.

I uninstalled angular-cli globally and then installed: npm install -g angular-cli@webpack

  1. The log given by the failure. Normally this include a stack trace and some
    more information.

when trying to run 'ng new PROJ_NAME' (or any other ng command) I get:

Error while running script "C:\nodejs\node_modules\angular-cli\addon\ng2\models\config\config.ts":
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.require.extensions..ts (C:\nodejs\node_modules\angular-cli\lib\bootstrap-local.js:30:14)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module._load (C:\nodejs\node_modules\angular-cli\lib\bootstrap-local.js:55:22)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (C:\nodejs\node_modules\angular-cli\addon\ng2\models\config.ts:7:16)
at Module._compile (module.js:434:26)
Error while running script "C:\nodejs\node_modules\angular-cli\addon\ng2\models\config.ts":
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.require.extensions..ts (C:\nodejs\node_modules\angular-cli\lib\bootstrap-local.js:30:14)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module._load (C:\nodejs\node_modules\angular-cli\lib\bootstrap-local.js:55:22)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (C:\nodejs\node_modules\angular-cli\addon\ng2\models\config.ts:7:16)
at Module._compile (module.js:434:26)
C:\nodejs\node_modules\angular-cli\addon\ng2\models\config\config.ts:23
this._config = new (schema_class_factory_1.SchemaClassFactory(schema))(configJson, ...fallbacks);
^^^

SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.require.extensions..ts (C:\nodejs\node_modules\angular-cli\lib\bootstrap-local.js:30:14)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module._load (C:\nodejs\node_modules\angular-cli\lib\bootstrap-local.js:55:22)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (C:\nodejs\node_modules\angular-cli\addon\ng2\models\config.ts:7:16)
at Module._compile (module.js:434:26)

  1. Mention any other details that might be useful.

Thanks! We'll be in touch soon.

Most helpful comment

You need to use node v6.5.0.

All 8 comments

Same issue on OS X 10.11.6

$ npm --version
3.10.6
$ node --version
v4.5.0

Same issue here using Windows 10

$ npm --version
3.10.7
$ node --version
v4.5.0

You need to use node v6.5.0.

@bonnici This fixed it!
Thanks!

Thanks , problem gets solved..

Thanks for helppp!!!!

The documentation indicates that

Both the CLI and generated project have dependencies that require Node 4 or higher, together with NPM 3 or higher.

I have a need to remain on node 4.7.2 and npm 3.10.10 - so does that mean im SOL?

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings