node_modules/rxjs/internal/types.d.ts(81,44): error TS1005: ';' expected error after installation of Angular 6

AngularTypescriptBuildInstallationRxjs

Angular Problem Overview


I got an error of

>node_modules/rxjs/internal/types.d.ts(81,44): error TS1005: ';' expected.

after the installation of Angular 6.

Check the 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.

Angular Solutions


Solution 1 - Angular

This problem might arise due to version mismatch. To solve your problem you need to do following changes in your package.json file.

Step 1 : Go to package.json and modify "rxjs": "^6.0.0" to "rxjs": "6.0.0"

Step 2 Run npm install in your project.

There is no need to change the typescript version. (Mine: "typescript": "~2.7.2")

Edit: If you are using rxjs-compat then you also need to do following in order to fixed the issue. change the rxjs-compat version from "rxjs-compat": "^6.2.2" to "rxjs-compat": "6.2.2"

Hope this will help!

Solution 2 - Angular

You need to do some changes in package.json

Go to package.json and modify "rxjs": "^6.0.0" to "rxjs": "6.0.0"

Then run npm update in your project

Solution 3 - Angular

I had the same error using angular 6 having [email protected] but i downgraded it to [email protected] it worked.

Solution 4 - Angular

Go to the project directory run this command

npm install [email protected] --save

Solution 5 - Angular

If you are using rxjs-compat then you also need to do following in order to fixed the issue. change the rxjs-compat version from

"rxjs-compat": "^6.2.2" 

to

"rxjs-compat": "6.2.2"

This works for me

Solution 6 - Angular

I just needed to edit the file and add the semicolon at the final line after 0 as shown here:

Go to the path [project directory]/node_modules/rxjs/internal and open the file types.d.ts as administrator, move to the final of the file and add a semicolon.

Original code: export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;

Modified code: export declare type ObservedValueOf<O> = O; extends ObservableInput<infer T> ? T : never;

Solution 7 - Angular

Earlier, I used to fix the problem with @TheParam's answer but lately started using yarn. Sadly I could not find yarn equivalent of

nmp update

I tried using

yarn upgrade

(although it is not equivalent of above command afaik) and it did not help.

I instead used

yarn add rxjs@6.0.0

and it worked. It took considerable time 82 sec as compared to few seconds in case of npm but fixed the issue. my node 8.11.2 and yarn 1.15.2

Solution 8 - Angular

I had same problem

npm install typescript@2.8.0 

solved my problem

Solution 9 - Angular

Go to package.json and update "rxjs": "^6.0.0" to "rxjs": "6.0.0" after that do npm update

Solution 10 - Angular

if you are still facing the problem, go to package.json

  1. remove rxjs and add rxjs-compat also, "rxjs-compat": "^6.4.0" to "rxjs-compat": "6.4.0",

  2. change the typscript version to 2.8

  3. run npm install

This will work for you!

Solution 11 - Angular

I had the same issue, the "rxjs": "^6.0.0" to "rxjs": "6.0.0" didn't work. I had to update my angular CLI to last stable npm install -g @angular/cli and regenerate the project again.

My config now is :

Angular CLI: 7.3.6
Node: 10.15.3
OS: win32 x64
Angular: 7.2.9

Solution 12 - Angular

This issue is caused by version of typescript installed was not compatible with that of the rxjs installed.Installation of typescript as mentioned below helped me install the compatible version of typescript with that of the angular packages already installed.You can resolve the issue by the below command

npm install typescript 

This worked for me

Solution 13 - Angular

It is working fine with me when I changed "rxjs" in package.json from "^6.0.0" to "6.0.0" and then run

> "npm i"

Solution 14 - Angular

I got the same error.reason might be due to version mismatch

npm install [email protected] --save fix the error

Solution 15 - Angular

Just do the one changes in package.json file

"rxjs": "^6.0.0",

Just delete the ^ like i did in the below code & update the npm(node package manager)

"rxjs": "6.0.0",

npm update

ng serve --open

Now file your project will start normally

Solution 16 - Angular

This is my solution:

npm install rxjs@6.0.0 --save

ng server

Solution 17 - Angular

Go To package.json and modify "rxjs": "^6.0.0" to "rxjs": "6.0.0"

Then run

npm update

Then start the server

ng serve

Problem solved 100%

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSSPView Question on Stackoverflow
Solution 1 - AngularTheParamView Answer on Stackoverflow
Solution 2 - AngularSachith WickramaarachchiView Answer on Stackoverflow
Solution 3 - AngularShashikant PanditView Answer on Stackoverflow
Solution 4 - AngularshrikantbishoyeView Answer on Stackoverflow
Solution 5 - AngularTuts DevView Answer on Stackoverflow
Solution 6 - AngularEduardo Tuteggito RoseroView Answer on Stackoverflow
Solution 7 - Angularuser3792812View Answer on Stackoverflow
Solution 8 - AngularRita PunjabiView Answer on Stackoverflow
Solution 9 - AngularNarendra SagadevanView Answer on Stackoverflow
Solution 10 - AngularCharuka HerathView Answer on Stackoverflow
Solution 11 - AngularwaloxView Answer on Stackoverflow
Solution 12 - AngularDeepak Ramakrishnan KalidassView Answer on Stackoverflow
Solution 13 - AngularMenna RamadanView Answer on Stackoverflow
Solution 14 - AngularSumith EkanayakeView Answer on Stackoverflow
Solution 15 - AngularPrasenjit MahatoView Answer on Stackoverflow
Solution 16 - AngularJunior VieiraView Answer on Stackoverflow
Solution 17 - AngularSushilView Answer on Stackoverflow