primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Chart: Can't resolve module

Open TylerKnvpp opened this issue 6 years ago • 7 comments

TylerKnvpp avatar May 17 '20 15:05 TylerKnvpp

Module not found: Can't resolve 'chart.js' in '/client/node_modules/primereact/components/chart'

TylerKnvpp avatar May 17 '20 15:05 TylerKnvpp

Try simply deleting your node_modules; and re-run npm i. Or else you can try to delete your package-lock.json too (combined with node_modules) and re-run npm i. Note that this will update your dependencies according to what you've specified in package.json.

MagicLegend avatar May 18 '20 13:05 MagicLegend

I did several times. Tried with npm & yarn as well.

TylerKnvpp avatar May 18 '20 13:05 TylerKnvpp

Can you post your package.json here? Or upload a sample-project to reproduce this issue?

MagicLegend avatar May 18 '20 13:05 MagicLegend

@TylerKnvpp You should add "chart.js" dependency into your project. npm install chart.js --save or yarn add chart.js --dev

https://www.primefaces.org/primereact/showcase/#/setup

mefallit avatar Aug 11 '20 12:08 mefallit

Apologies for bumping an older thread, but I just stumbled upon this as well. Wouldn't this warrant a peerDependencies entry? I realize it's an optional dependency based on whether you plan to use the Chart component, but isn't this the sort of thing peerDependencies is meant for? I see that chart.js is a devDependency in the package json. Without an entry in peerDependencies, it's not 100% clear which version of the dependent library is required.

austinbruch-sas avatar Nov 12 '20 21:11 austinbruch-sas

Please use the forum or discord channel for questions and help requests.

mcandu avatar Aug 17 '21 14:08 mcandu