Running “ng” causes “Unexpected token …”

2019-09-13 04:03发布

When I run ng with any command, then causes

ng -v

C:\nodejs\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: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:\nodejs\node_modules\@angular\cli\models\config.js:3:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

node -v v6.10.0

npm -v 4.4.1

I tried reinstalling the node, npm and @angular/cli. No solution has helped.

@Edited, Solution

I deleted ng, ng.cmd from C:\nodejs\ and folders @angular/cli/, angular-cli/ fromC:\nodejs\node_modules, and reinstall @angular/cli, and then works correctly.

0条回答
登录 后发表回答