ng 新的 my-app 意外令牌 = [英] ng new my-app unexpected token =

查看:18
本文介绍了ng 新的 my-app 意外令牌 =的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have installed the angular2 cli via npm, but when I try to create a new typescript angular app with the command 'ng new my-app' I keep getting this error:

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我的节点版本是 4.4.5,据我所知,这是安装和使用 angular-cli 的可接受版本.

My NPM version is 4.1.2 My node version is 4.4.5 which from my understanding are acceptable versions for installing and using the angular-cli.

请让我知道是否有解决方案,我也尝试过卸载、清理 npm 缓存并重新安装,但我一直遇到同样的问题.

Please let me know if there is a fix to this, I have also tried uninstalling, cleaning npm cache and reinstalling but I keep getting the same issue.

非常感谢任何和所有帮助,提前致谢!

Any and all help is very appreciated, thanks in advance!

推荐答案

如果你已经安装了 @angular/cli,你需要NodeJS 更高6.9.7,以及NPM 3 或更高.

If you have installed @angular/cli, you need NodeJS higher 6.9.7, together with NPM 3 or higher.

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

If you have installed angular-cli, you need NodeJS higher than 4.4.x, together with NPM 3 or higher.

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

For more see the links above and read the prerequisites.

这篇关于ng 新的 my-app 意外令牌 =的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆