通过CLI

时间:2017-02-14 04:47:01

标签: angular angular-cli

我正在尝试使用@angular cli来创建一个新的角度2项目。安装进行得很顺利,但是当我尝试创建一个新站点时,我收到以下错误。有没有人碰到这个?

/usr/local/lib/node_modules/@angular/cli/models/config/config.js:15
    constructor(_configPath, schema, configJson, fallbacks = []) {
                                                           ^

SyntaxError: Unexpected token =
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/@angular/cli/models/config.js:2:18)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

实际上,看起来像@angular cli没有安装。我无法得到--version,当我查看安装结果时,我看到以下警告:

npm WARN @ngtools/webpack@1.2.9 requires a peer of @angular/compiler@^2.3.1 || >=4.0.0-beta <5.0.0 but none was installed.
npm WARN @ngtools/webpack@1.2.9 requires a peer of @angular/compiler-cli@^2.3.1 || >=4.0.0-beta <5.0.0 but none was installed.
npm WARN @ngtools/webpack@1.2.9 requires a peer of @angular/core@^2.3.1 || >=4.0.0-beta <5.0.0 but none was installed.
npm WARN @ngtools/webpack@1.2.9 requires a peer of @angular/tsc-wrapped@^0.5.0 but none was installed.

1 个答案:

答案 0 :(得分:3)

也许您的Nodejs版本已过期?确保您拥有最新的LTS 6.x