Error TS1005: ';' expected. TypeScript Angular 6 For First Build error rxjs inside node_modules
Solution 1
I had the same issue. I investigated that rxjs released a new version: 6.4.0
. And it broke the build. According to review, the minimum supported version of TypeScript is 2.8
. If you don't want to update TypeScript version, just change "rxjs": "^6.0.0", to "rxjs": "6.3.3"
in package.json
.
Solution 2
I was facing the same issue while developing an angular6 project. I spent more time finally it's working for me.
Here is the solution:
Open "package.json"
-
rxjs
and "TypeScript" verstion like below screenshot -
Change like the below screenshot:
Next go to your project folder and delete "node_modules" folder.
After delete, next run
npm install
in your project folderFinally run
ng serve
. It should work (I tried 3 projects and confirmed).
Solution 3
Just remove ^
character from "rxjs": "^6.0.0"
from package.json
file and make it "rxjs": "6.0.0"
. It should work fine.
Solution 4
Today I faced the same issue. None of the above answers worked except a comment from one @Nasreen Ustad. So what you have to do is:
- Go to package.json and modify
"rxjs": "^6.0.0"
to"rxjs": "6.0.0"
- Run
npm update
in your project
No need to change typescript version.(Mine: "typescript": "~2.7.2"
)
Solution 5
Go to the project directory run: npm install [email protected] --save
Related videos on Youtube
Rifat Murtuza
Updated on July 05, 2022Comments
-
Rifat Murtuza almost 2 years
I'm building my first Angular Application. I'm creating a new Angular application using this command
ng new purchase-section
. But when I executing the application usingng serve -o
I got the 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 have inspected
types.d.ts
as I know it is created by Angular. I'm not able to understand the error. Note that after I got this error I deletednode_modules
and I installed usingnpm install
wished I got away still I got this error.Here is my
package.JSON
file:{ "name": "purchase-section", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^6.0.3", "@angular/common": "^6.0.3", "@angular/compiler": "^6.0.3", "@angular/core": "^6.0.3", "@angular/forms": "^6.0.3", "@angular/http": "^6.0.3", "@angular/platform-browser": "^6.0.3", "@angular/platform-browser-dynamic": "^6.0.3", "@angular/router": "^6.0.3", "core-js": "^2.5.4", "rxjs": "^6.0.0", "zone.js": "^0.8.26" }, "devDependencies": { "@angular-devkit/build-angular": "~0.6.8", "@angular/cli": "~6.0.8", "@angular/compiler-cli": "^6.0.3", "@angular/language-service": "^6.0.3", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "codelyzer": "~4.2.1", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "^4.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.0", "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "^5.4.2", "ts-node": "~5.0.1", "tslint": "~5.9.1", "typescript": "~2.7.2" } }
-
martin about 5 yearsRelated issue on RxJS GitHub page: github.com/ReactiveX/rxjs/issues/4512
-
yfdgvf asdasdas about 5 yearsHey did you ever find a answer to this problem, I am having the same issue and none of the below answers solved anything. By the way I am using ng4(Angular 4).
-
user3629249 about 5 yearswhich line is line 81?
-
Inzamam Malik about 4 yearsthis might help stackoverflow.com/a/59941420/4378475
-
-
Code_maniac about 5 yearsRestart Visual Studio after this. What is your TS version now?
-
kalai about 5 yearsi have same issue my "typescript": "~3.2.2" and "rxjs": "6.3.3" please tell me anyone how to solve this error?
-
Viocartman about 5 yearsThis seems to work for me but do you know what the actual reason for this error is ? I mean until now it worked fine with the "^" symbol. Do you maybe have more details regarding what is causing this error ? Thanks
-
Jeremy Thille about 5 yearsI then had to delete my
node_modules
and runnpm i
again, but it worked. (Alternative :npm update
) -
Nasreen Ustad about 5 yearsjust change "rxjs": "^6.0.0", to "rxjs": "6.3.3" in package.json and run command npm install again so it will update it in your project. Now It will work
-
double-beep about 5 yearsThis is just a duplicate answer of this one IMO. Before posting here, check the other answers.
-
bakytn about 5 yearsthis helped me. Thanks! (new version 2.9.2 worked perfectly)
-
rohan dani about 5 yearsAlso if your package.json has a dependency for rxjs-compat then make that also 6.3.3 so you will not get any errors
-
codemt about 5 years@kalai hi , i had the same problem , i changed rxjs version to 6.3.3 , and removed node modules and installed again , and now it is working , i am using typescript version 2.7.2
-
Prageeth godage about 5 yearsfor details read @langrenn answer in below I think it is the reason.
-
kalai about 5 years@codemt my project running successfully on command prompt but getting error only in visual studio 2017
-
codemt about 5 years@kalai then it looks some problem with VS version , upgrade to the latest version and see what happens.
-
Swanand Pangam almost 4 years@shubham actually I have now moved to angular 10. Couldn't simulate this.
-
Anish Sinha over 2 yearsyes thanks - visual studio excludes node_modules when it is hidden.
-
Bionix1441 over 2 yearsI have the same problem, but this does not help me to fix the problem. Any ideas? I am trying to run the command
npm start
for the following project github.com/angulardeveloper-io/ngrx-store-app.