Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

634
Views
How to fix ERROR in node_modules/chart.js/types/animation.d.ts(20,37): error TS1005: ',' expected. in chart.js

I am working on an Angular 6 project where I want to create some charts using chart.js.

I installed chart.js using npm install chart.js and its version is like 3.5.1. My TypeScript version is like 2.9.0.

So when I try to ng serve.

node_modules/chart.js/types/animation.d.ts(20,37): error TS1005: ',' expected.
node_modules/chart.js/types/animation.d.ts(20,46): error TS1005: ',' expected.
node_modules/chart.js/types/index.esm.d.ts(39,56): error TS1005: ';' expected.
node_modules/chart.js/types/index.esm.d.ts(39,58): error TS1011: An element access expression should take an argument.
node_modules/chart.js/types/index.esm.d.ts(39,85): error TS1005: '(' expected.
node_modules/chart.js/types/index.esm.d.ts(535,38): error TS1005: ',' expected.
node_modules/chart.js/types/index.esm.d.ts(535,56): error TS1005: ',' expected.
node_modules/chart.js/types/index.esm.d.ts(2424,37): error TS1005: ',' expected.
node_modules/chart.js/types/index.esm.d.ts(2424,50): error TS1005: ',' expected.
node_modules/chart.js/types/index.esm.d.ts(2734,63): error TS1005: ';' expected.
node_modules/chart.js/types/index.esm.d.ts(2734,69): error TS1011: An element access expression should take an argument.
node_modules/chart.js/types/index.esm.d.ts(2738,22): error TS1011: An element access expression should take an argument.
node_modules/chart.js/types/index.esm.d.ts(2742,63): error TS1005: '(' expected.
node_modules/chart.js/types/index.esm.d.ts(2746,57): error TS1005: '(' expected.
node_modules/chart.js/types/index.esm.d.ts(2746,68): error TS1005: ',' expected.
node_modules/chart.js/types/index.esm.d.ts(2746,75): error TS1011: An element access expression should take an argument.
node_modules/chart.js/types/index.esm.d.ts(2746,76): error TS1005: ')' expected.
node_modules/chart.js/types/index.esm.d.ts(2763,26): error TS1011: An element access expression should take an argument.
node_modules/chart.js/types/index.esm.d.ts(2767,67): error TS1005: '(' expected.
node_modules/chart.js/types/index.esm.d.ts(2771,56): error TS1005: '(' expected.
node_modules/chart.js/types/index.esm.d.ts(2771,67): error TS1005: ',' expected.
node_modules/chart.js/types/index.esm.d.ts(2771,73): error TS1011: An element access expression should take an argument.
node_modules/chart.js/types/index.esm.d.ts(2771,74): error TS1005: ')' expected.
node_modules/chart.js/types/index.esm.d.ts(2788,1): error TS1128: Declaration or statement expected.

What is this and how to fix this?

Thanks, Dasun.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I try out several solutions but could not find them, So I just downgrade the chartjs 3.5.1 to 2.7.3. So it is working fine.

over 4 years ago · Santiago Trujillo Report

0

As others have stated, downgrading to chart.js version 2.7.3 fixed this for me. For anyone not super familiar with npm, here's the commands I used to update the package:

npm remove chart.js --save
npm install chart.js@2.7.3 --save

I specifically did this for my ionic 5 project. But it should also work for angular.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!