angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

syntax error when running 'ng new' with [email protected]

Open nvitas opened this issue 10 years ago • 8 comments

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.

nvitas avatar Sep 07 '16 16:09 nvitas

Same issue on OS X 10.11.6

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

kruser avatar Sep 07 '16 17:09 kruser

Same issue here using Windows 10

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

9thwall avatar Sep 07 '16 20:09 9thwall

You need to use node v6.5.0.

bonnici avatar Sep 08 '16 00:09 bonnici

@bonnici This fixed it! Thanks!

9thwall avatar Sep 08 '16 00:09 9thwall

Thanks , problem gets solved..

Thanks for helppp!!!!

HigorSenna avatar Mar 03 '17 21:03 HigorSenna

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?

kevindashgit avatar Jun 10 '17 02:06 kevindashgit

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.