[英]ng serve throwing errors with simple ng new angular cli project
I am new to a angular-cli
and have created an angular 2 project with ng new angular2
command. 我是angular-cli
新手,并使用ng new angular2
命令创建了一个角度2项目。 Now when I try to run it with ng serve
, it just crashes with some errors. 现在,当我尝试使用ng serve
运行它时,它只是崩溃了一些错误。
Log: 日志:
ERROR in [default] C:\Users\user\desktop\angularcli\node_modules\@types\jasmine\index.d.ts:39:37
A parameter initializer is only allowed in a function or constructor implementation.
ERROR in [default] C:\Users\user\desktop\angularcli\node_modules\@types\jasmine\index.d.ts:39:45
Cannot find name 'keyof'.
ERROR in [default] C:\Users\user\desktop\angularcli\node_modules\@types\jasmine\index.d.ts:39:51
'=' expected.
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 2.81 kB 0
webpack: Failed to compile.
I don't know why I get this trace as I haven't made any changes in the files. 我不知道为什么我得到这个跟踪,因为我没有对文件进行任何更改。 Does anyone know why this error occurs or someone might have encountered it before. 有谁知道为什么会发生这个错误或者之前有人遇到过它。
Sharing the config that I get on running ng --version
- 共享运行ng --version
-
angular-cli: 1.0.0-beta.18
node: 6.9.5
os: win32 x64
Thanks for helping. 谢谢你的帮助。
I had this same problem, you are still using the beta version of angular cli - they have now have an RC version. 我有同样的问题,你仍然使用角度cli的beta版本 - 他们现在有一个RC版本。 Upgrading will fix your issue. 升级将解决您的问题。 Also worth noting that the project has moved in NPM it is now @angular/cli
instead of angular-cli
. 另外值得注意的是,该项目已在NPM中移动,现在是@angular/cli
而不是angular-cli
。
This page will show you how to upgrade - it gives instructions on how to upgrade globally and also how to upgrade individual projects (you will need to do both). 此页面将向您展示如何升级 - 它提供了有关如何全局升级以及如何升级单个项目的说明(您需要同时执行这两项操作)。
Note: Not essential but it will also give you warnings if you aren't running Node 6.9 + 注意:不是必需但如果您没有运行节点6.9 +,它也会给您警告
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.