Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve 'chart.js/src/chart.js' #913

Closed
DarkestMisery opened this issue Jun 5, 2019 · 1 comment
Closed

Can't resolve 'chart.js/src/chart.js' #913

DarkestMisery opened this issue Jun 5, 2019 · 1 comment
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@DarkestMisery
Copy link

[x] bug report

Current behavior

Currently using Prime React in a project, and most of the time there is no error, but once in a while when deploying to a new machine, the following error occurs: Can't resolve 'chart.js/src/chart.js'

Part of my Package.json

  "dependencies": {
    ...
    "chart.js": "^2.4.0",
    ...
    "primeflex": "^1.0.0-rc.1",
    "primeicons": "^1.0.0-beta.10",
    "primereact": "^2.0.1",
    ...
    "react": "^16.8.1",
    ...
  }

Expected behavior
It should be able to find the chart.js dependency

Minimal reproduction of the problem with instructions
Error is intermitent

Please tell us about your environment:
Ubuntu 18
npm -version
6.9.0
node --version
v9.4.0

  • React version:
    16.8

  • PrimeReact version:
    2.0.1

  • Language:
    ES6/7

  • Solution:
    Sometimes the error is fixed by doing npm install --save chart.js

However I was able to completely fix it by changing line 18 in node_modules/primereact/components/chart/Chart.js:

var _chart = require('chart.js/src/chart.js');

to this

var _chart = require('chart.js/dist/Chart.js');

This fixed my problem.

I am more than willing to provide the patch but I am unsure as to how to proceed.

Thank you very much.

@mertsincan mertsincan self-assigned this Jun 21, 2019
@mertsincan mertsincan added the Type: Bug Issue contains a defect related to a specific component. label Jun 21, 2019
@mertsincan mertsincan added this to the 3.1.5 milestone Jun 21, 2019
@Edgar-K
Copy link

Edgar-K commented Jun 8, 2020

@DarkestMisery thanks, your advice was very helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

3 participants