Angular CLI 错误

Angular CLI Error

已通过以下命令安装 angular CLI。

npm install -g angular-cli@webpack

安装时显示以下消息:

npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash-node@2.4.1: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
/usr/local/bin/ng -> /usr/local/lib/node_modules/angular-cli/bin/ng
/usr/local/lib
└─┬ angular-cli@1.0.0-beta.11-webpack.2 
  ├─┬ css-loader@0.23.1
  │ └─┬ cssnano@3.7.4
  │   └─┬ autoprefixer@6.4.0
  │     └── caniuse-db@1.0.30000525 
  └── UNMET PEER DEPENDENCY typescript@2.0.0

npm WARN @angular/tsc-wrapped@0.2.2 requires a peer of typescript@^1.9.0-dev but none was installed.
npm WARN tsickle@0.1.6 requires a peer of typescript@^1.8.0 || ^1.9.0-dev but none was installed.
npm WARN tsickle@0.1.6 requires a peer of typescript@^1.8.0 || ^1.9.0-dev but none was installed.

现在,每当我尝试使用 ng new proj_name 命令时,它都会显示以下错误:

/usr/local/lib/node_modules/angular-cli/bin/ng:7
const resolve = require('resolve');
^^^^^
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:929:3

这里有什么问题?

更新:

节点版本:v0.10.35

Npm 版本:3.10.5

你收到的警告是 "normal",我也收到了,cli 可以正常工作。

该解决方案似乎与您的节点版本有关(请参阅此 or this GitHub issue)。

constES6引入,node0.12以下版本不支持。 尝试更新您的 node 版本

检查this link以获得详细解释