node.js - ng new my-app 意外 token =

标签 node.js angular angular-cli

我已经通过 npm 安装了 angular2 cli,但是当我尝试使用命令“ng new my-app”创建一个新的 typescript angular 应用程序时,我不断收到此错误:

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

我的 NPM 版本是 4.1.2 我的 Node 版本是 4.4.5,据我了解,这是安装和使用 angular-cli 的可接受版本。

如果有解决办法,请告诉我,我也尝试过卸载、清理 npm 缓存并重新安装,但我一直遇到同样的问题。

非常感谢任何和所有帮助,在此先感谢!

最佳答案

如果您已安装 @angular/cli ,你需要 NodeJS 更高的6.9.7,以及 NPM 3 或更高的。

如果您已安装 angular-cli ,您需要 NodeJS 高于 4.4.x,以及 NPM 3 或更高。

有关更多信息,请参阅上面的链接并阅读先决条件。

关于node.js - ng new my-app 意外 token =,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42166096/

相关文章:

javascript - Angular-CLI 中带散点图的 D3 V4 多线图

node.js - 停止 Heroku 运行 npm start + 运行什么?

javascript - 如何正确处理回调堆栈

Angular-CLI ng 新的 : "Error: EPERM: operation not permitted..."

Angular 构建索引文件 : where does the injected style come from?

javascript - setTimeout 内的函数给出未定义

node.js - Sequelize : Associating two columns in one table. 添加关联后,插入行时出现错误

javascript - 使用 WebSockets 获取客户端列表

css - 如何使用 Bootstrap 4 flexbox 填充可用内容?

angular - next.materialize 初始化没有 jQuery