Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

621
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda