Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

ERROR in node_modules/@types/babel__traverse/index.d.ts(68,50): error TS1005: ']' expected

Ask Question

I'm updating angular 5 to 6V.

I followed all the steps in the guide - https://update.angular.io/?v=5.2-6.0

ng version
Angular CLI: 6.2.9
Node: 14.15.5
OS: linux 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.8.9
@angular/cdk                      5.2.5
@angular/cli                      6.2.9
@angular/material                 5.2.5
@angular/platform-server          5.2.10
@ngtools/webpack                  6.0.8
@schematics/angular               0.8.9
@schematics/update                0.8.9
rxjs                              6.0.0
typescript                        2.9.2
webpack                           4.8.3

now when im running ng serve I'm getting a large error msg regarding my @type

example:

ERROR in node_modules/@types/babel__traverse/index.d.ts(68,50): error TS1005: ']' expected.
node_modules/@types/babel__traverse/index.d.ts(68,53): error TS1005: ';' expected.
node_modules/@types/babel__traverse/index.d.ts(68,58): error TS1005: ';' expected.
node_modules/@types/babel__traverse/index.d.ts(68,70): error TS1011: An element access expression should take an argument.
node_modules/@types/babel__traverse/index.d.ts(68,83): error TS1005: ';' expected.
node_modules/@types/babel__traverse/index.d.ts(68,84): error TS1128: Declaration or st

In my research, I saw that I have to update Typescript to a newer version, when updating to the latest im getting an error saying I must use typescript@">=2.7.2 <2.10" (now im using "typescript": "^2.9.2", ) I ran this command but it still returns the same error. Any idea?

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Compositr Dec 16, 2022 at 12:20 In my case also issue with the typescript version, I just updated the typescript version to the latest (4.9.5) and the issue got resolved – RameshN Feb 15 at 13:07

Less offensive approach is to add babel dependencies to your package.json file:

"typescript": "3.8.3",
"@types/babel__core": "7.1.18",
"@types/babel__traverse": "7.14.2",

After this run npm install

You can match babel version to typescript by information included in their package repositories (check column named 'Tag').

https://www.npmjs.com/package/@types/babel__traverse?activeTab=versions

https://www.npmjs.com/package/@types/babel__core?activeTab=versions

In my case babel version was overridden by newest because of installation of other package that depend on it.

Solution author:

https://stackoverflow.com/a/74824145/9950085

i did yarn add @types/babel__traverse@7.17.1 and yarn add @types/babel__core@7.1.19 to my typescript 3.9.10. But the error is still there. – SoftTimur Mar 21 at 7:23 Try to reinstall your node_modules npm install. I got also package.lock.json which I sometimes delete before npm install. In this file you can also check where babel occurs and define which library override you babel version. – Falcon Mar 21 at 14:54 Thank you for your answer, i tried to do it again, but i am still getting this error: ERROR in The Angular Compiler requires TypeScript >=2.7.2 and <2.10.0 but 3.4.2 was found instead. – Noy M Jun 23, 2022 at 6:41

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.