IBM / gantt-chart

IBM Gantt Chart Component, integrable in Vanilla, jQuery, or React Framework.
https://ibm.github.io/gantt-chart/packages/ibm-gantt-chart-docs/storybook
Apache License 2.0
209 stars 52 forks source link

Problem with the React peer dependency in the latest CRA template #48

Open TomasHubelbauer opened 2 years ago

TomasHubelbauer commented 2 years ago

Hi, I am attempting to evaluate this component in an application based on Create React App. The CRA template I have used is recent, and it uses React 18. It seems the React peer dependency of ibm-gantt-chart-react is hardcoded to 16.8.6:

https://github.com/IBM/gantt-chart/blob/master/packages/ibm-gantt-chart-react/package.json#L42

When trying to install the component using npm i ibm-gantt-chart-react, NPM throws this error:

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: tomashubelbauer@0.1.0 npm ERR! Found: react@18.0.0 npm ERR! node_modules/react npm ERR! react@"^18.0.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"16.8.6" from ibm-gantt-chart-react@0.5.22 npm ERR! node_modules/ibm-gantt-chart-react npm ERR! ibm-gantt-chart-react@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or U npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

This error will likely happen to anyone using latest React, regardless of whether they are using CRA or not.

Using npm i ibm-gantt-chart-react --legacy-peer-deps works, because to my knowledge there are no breaking changes between 16.8.6 and 18.0.0 that would prevent this component from working.

I think you could solve this issue by not hardcoding a React version in the peer dependency, but instead making it a range that accepts anything between 16.8.6 and 18. See these links:

Hope this helps.

PauliusVa commented 2 years ago

When i start this project it also has this errors: Failed to parse source map: 'webpack://ibm-gantt-chart/C:/Users/yotamberk/Desktop/workspace/vis/dist/vis.js' URL is not supported.

Any ideas how to fix it ?

NatsGt commented 1 year ago

I am using React 18.2.0 and I am getting this recurrent error.

Cannot read properties of undefined (reading 'appendChild') GanttPanel.create https://s8yt6v.csb.app/node_modules/ibm-gantt-chart/dist/ibm-gantt-chart.js:18692:17 GanttPanel.setConfiguration https://s8yt6v.csb.app/node_modules/ibm-gantt-chart/dist/ibm-gantt-chart.js:18595:14

I can see that the component is getting rendered, but still getting this error. I had to downgrade to React 17 to make it work.

EricWebsmith commented 1 year ago

I am using React 18.2.0 and I am getting this recurrent error.

Cannot read properties of undefined (reading 'appendChild') GanttPanel.create https://s8yt6v.csb.app/node_modules/ibm-gantt-chart/dist/ibm-gantt-chart.js:18692:17 GanttPanel.setConfiguration https://s8yt6v.csb.app/node_modules/ibm-gantt-chart/dist/ibm-gantt-chart.js:18595:14

I can see that the component is getting rendered, but still getting this error. I had to downgrade to React 17 to make it work.

same here