accordproject / web-components

React Components for Accord Project
Apache License 2.0
117 stars 94 forks source link

npm install doesn't work for @accordproject/ui-markdown-editor #351

Closed RichardSefton closed 3 years ago

RichardSefton commented 3 years ago

Bug Report 🐛

when trying to run npm install @accordproject/ui-markdown-editor @accordproject/markdown-slate slate slate-history slate-react semantic-ui-react semantic-ui-css npm throws errors for the dependency tree (ERESOLVE unable to resolve dependency tree). The issue seems to be stemming from @acordproject/ui-markdown-editor `root@e0c61b7a7e5d:/usr/src/node/app# npm install @accordproject/ui-markdown-editor npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! Found: react@17.0.1 npm ERR! node_modules/react npm ERR! peer react@"^16.8.0 || ^17" from @fluentui/react-component-event-listener@0.51.7 npm ERR! node_modules/@fluentui/react-component-event-listener npm ERR! @fluentui/react-component-event-listener@"~0.51.6" from semantic-ui-react@2.0.3 npm ERR! node_modules/semantic-ui-react npm ERR! semantic-ui-react@"^2.0.3" from the root project npm ERR! @fluentui/react-component-event-listener@"^0.51.7" from the root project npm ERR! peer react@"^16.8.0 || ^17" from @fluentui/react-component-ref@0.51.7 npm ERR! node_modules/@fluentui/react-component-ref npm ERR! @fluentui/react-component-ref@"~0.51.6" from semantic-ui-react@2.0.3 npm ERR! node_modules/semantic-ui-react npm ERR! semantic-ui-react@"^2.0.3" from the root project npm ERR! @fluentui/react-component-ref@"^0.51.7" from the root project npm ERR! 22 more (@restart/context, @restart/hooks, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.8.0" from semantic-ui-react@0.88.2 npm ERR! node_modules/@accordproject/ui-markdown-editor/node_modules/semantic-ui-react npm ERR! semantic-ui-react@"^0.88.2" from @accordproject/ui-markdown-editor@0.97.0 npm ERR! node_modules/@accordproject/ui-markdown-editor npm ERR! @accordproject/ui-markdown-editor@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See /root/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-06-02T16_51_08_606Z-debug.log`

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce

1. 2. 3. 4.

Context (Environment)

I am unable to install the node modules to use the markdown editor in a project

Laptop

Detailed Description

Possible Implementation

dselman commented 3 years ago

I think what the error is saying is that @accordproject/ui-markdown-editor has a peer dependency on react@"^16.8.0" but it found React 0.17.

Here is a starter project that should be useful: https://github.com/accordproject/web-components-starter

RichardSefton commented 3 years ago

i don't think its 0.17. it should be ^17 as my web app framework is using 17.0.1. does this module not support version 17 of react?

I have also since tried npm install on a clean react instance using npx react-app-build (as opposed to my own custom implementation of react with my own webpack script) followed by the npm install for these modules and getting an error trying to render MarkdownEditor

`Failed to compile.

./node_modules/@accordproject/ui-markdown-editor/lib/index.esm.js Module not found: Can't resolve 'styled-components' in 'C:\Users\Richard.sefton\OneDrive - The NAV People\Code\js\test\node_modules\@accordproject\ui-markdown-editor\lib'`

This is using 17.0.2 version of react. and the node version on my local (windows) machine is 12.18.1 and npm version 6.14.5

dselman commented 3 years ago

We've not tested the component with React 0.17 AFAIK.

However, styled-components is also a peer dependency: https://github.com/accordproject/web-components/blob/master/packages/ui-markdown-editor/package.json#L96 of this component.

Peer dependencies for npm packages must be added to the module that is using this component, and you must use the correct version of the peer dependency.

Did you test the starter project I referenced above?

RichardSefton commented 3 years ago

its fine. I built an editor with draft.js and found a module that easily converts draft to markdown elsewhere in the end.

jeromesimeon commented 3 years ago

@RichardSefton closing this issue. Feel free to reopen if you want to follow up.