Skip to content

Docs vs peerDependencies mismatch: README says “Chart.js 3.0.0 or later” but package.json requires "> 3" #24

@tsubasahirakida

Description

@tsubasahirakida

Body

Hi, thanks for the great plugin!

There seems to be a discrepancy between the README and the published package.json which leads to a peer dependency conflict on npm 7+ / 10.

What I did

  1. Create a minimal project:
// package.json
{
  "private": true,
  "name": "repro-outlabels-peer",
  "version": "0.0.0",
  "dependencies": {
    "chart.js": "3.9.1",
    "@energiency/chartjs-plugin-piechart-outlabels": "1.3.5"
  }
}
  1. Run install
npm install
  1. Installation fails with a peer dependency resolution error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: repro-outlabels-peer@0.0.0
npm ERR! Found: chart.js@3.9.1
npm ERR! node_modules/chart.js
npm ERR!   chart.js@"3.9.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer chart.js@"> 3" from @energiency/chartjs-plugin-piechart-outlabels@1.3.5
npm ERR! node_modules/@energiency/chartjs-plugin-piechart-outlabels
npm ERR!   @energiency/chartjs-plugin-piechart-outlabels@"1.3.5" from the root project

Why this is confusing

  • README says the plugin “requires Chart.js 3.0.0 or later” (i.e. >= 3.0.0).
  • package.json has:
{
  "peerDependencies": {
    "chart.js": "> 3"
  }
}

In theory, > 3 should mean “greater than 3.0.0” and thus include 3.0.1–3.x and 4.x.
However, with npm 7+/10’s strict peer resolution, this range appears to be treated as incompatible with 3.9.1, producing ERESOLVE.

So users following the README and installing Chart.js 3.x run into an error.

Proposed fix

  • If 3.x is intended to be supported: change the peer range to
"peerDependencies": {
  "chart.js": ">= 3.0.0"
}

(or at least ">= 3.0.0"), and keep the README as-is.

  • If 4.x+ only is intended:
"peerDependencies": {
  "chart.js": ">= 4"
}

and update the README to say “Chart.js 4.0.0 or later”.
Happy to open a PR once the intended support window is confirmed. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions