Aakash Thakur
Aakash Thakur

Reputation: 3895

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. Now when I try to run it with ng serve, it just crashes with some errors.

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-

angular-cli: 1.0.0-beta.18
node: 6.9.5
os: win32 x64

Thanks for helping.

Upvotes: 1

Views: 1532

Answers (1)

cconolly
cconolly

Reputation: 366

I had this same problem, you are still using the beta version of angular cli - they have now have an RC version. Upgrading will fix your issue. Also worth noting that the project has moved in NPM it is now @angular/cli instead of 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 +

Upvotes: 3

Related Questions