Atul
Atul

Reputation: 1590

rxjs version error while running npm install

I was working on a new Angular App. I created that using Angular CLI with ng new.

When I tried to lauch that app using npm start , I got following error :

ERROR in node_modules/rxjs/internal/types.d.ts(81,44): error TS1005: ';' expected.
node_modules/rxjs/internal/types.d.ts(81,74): error TS1005: ';' expected.
node_modules/rxjs/internal/types.d.ts(81,77): error TS1109: Expression expected.

I inspected the dependencies using ng -version inside that project and found below output.

Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cdk                      7.2.1
@angular/cli                      6.0.8
@angular/material                 7.2.1
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.3.3
typescript                        2.7.2
webpack                           4.8.3

I had another Angular app installed on my machine .

I ran ng -version again in this app giving below result.

Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cli                      6.0.8
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.4.0
typescript                        2.7.2
webpack                           4.8.3

Comapring the results , I got below difference

App Giving error has

rxjs                              6.4.0

And App running fine has

rxjs                              6.3.3

I changed the rxjs version in not running app to below in package.json like below :

"rxjs": "6.3.3" 

and the problem got resolved

So I have below questions , can anybody please answer these ?

1)I am not able to analyse why downgrading rxjs version resolved the issue ? Since all other component versions are the same in both the apps . First app (not running one uses angular material as addition)

2)I had two apps to compare the versions . Had it not been the case , is there any way to find out this error is due to rxjs downgrading of version ?

Upvotes: 0

Views: 5613

Answers (1)

Redjon Sulaj
Redjon Sulaj

Reputation: 94

Answer 1 & 2 : Downgrading rxjs version resolved bcz you're using a old compiler version.
Find yours at package.json CTRL+F typescript
Try installing the newest version of typescript:

npm install -g typescript@latest. 

You can also use npm update instead of install, without the latest modifier.

Upvotes: 1

Related Questions