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

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

问题描述

我已经通过npm安装了angular2 cli,但是当我尝试使用命令'ng new my-app'创建一个新的打字稿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 我的节点版本为4.4.5,据我了解,这是安装和使用angular-cli的可接受版本.

请让我知道是否有此修复程序,我也尝试过卸载,清理npm缓存并重新安装,但是我仍然遇到同样的问题.

非常感谢您的帮助!

解决方案

如果已安装> strong> @ angular/cli ,则需要NodeJS更高的 6.9.7 ,以及NPM 3 或更高的水平.

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

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

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)

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.

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!

解决方案

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

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天全站免登陆