Thursday, February 23, 2017

Angular CLI–Error when invoking ng

After installing Angular CLI and trying to invoke it using the ng command it failed with the following error message:

Error while running script "C:\Users\root\AppData\Roaming\npm\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:373:25)
    at Object.require.extensions..ts (C:\Users\root\AppData\Roaming\npm\node_modules\angular-cli\lib\bootstrap-local.js:30:14)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module._load (C:\Users\root\AppData\Roaming\npm\node_modules\angular-cli\lib\bootstrap-local.js:55:22)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (C:\Users\root\AppData\Roaming\npm\node_modules\angular-cli\addon\ng2\models\config.ts:7:16)
    at Module._compile (module.js:409:26)
The error message itself didn’t help a lot. Luckily a colleague had the same issue before. He suggested that updating to the latest node.js version would probably solve the issue.
And indeed, an upgrade to Node 6.10(the latest LTS version on the moment of writing) solved the problem…

No comments: