question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-gh-like-diff@2.0.2 requires a peer of react@^16.0.0 but none is installed. You must install peer dependencies yourself.

See original GitHub issue

Hi @neighborhood999 ,

I’m strangely unable to get the module working after updating react to the latest version.

I am given the following warm: react-gh-like-diff@2.0.2 requires a peer of react@^16.0.0 but none is installed. You must install peer dependencies yourself.

What happens is that using the component it tells me this: Files changed (0)

But it’s impossible because the component looks like this:

<ReactGhLikeDiff
options={{
originalFileName: name,
updatedFileName: name,
}}
past={"Test"}
current={"Ok."}
/>

Package:

    "@date-io/moment": "^2.13.1",
    "@emotion/react": "^11.8.1",
    "@emotion/styled": "^11.8.1",
    "@mui/icons-material": "^5.4.4",
    "@mui/material": "^5.4.4",
    "@mui/styles": "^5.4.4",
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.3",
    "@testing-library/user-event": "^13.5.0",
    "docxtemplater": "^3.29.0",
    "file-saver": "2.0.5",
    "lodash": "4.17.21",
    "moment": "^2.29.1",
    "pizzip": "^3.1.1",
    "postcss": "^8.4.7",
    "prop-types": "^15.8.1",
    "react": "^17.0.2",
    "react-dark-mode-toggle": "0.2.0",
    "react-dom": "^17.0.2",
    "react-dropzone": "^12.0.4",
    "react-gh-like-diff": "^2.0.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "react-transition-group": "^4.4.2",
    "styled-components": "^5.3.3"

What am I doing wrong?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
1846689910commented, Apr 13, 2022

meet same issue, cannot work with react^17. Though the past and current files contain diff, the view shows Files changed (0)

0reactions
1846689910commented, Apr 20, 2022

@neighborhood999 I tried to use react^17 and react-scripts^5 to work on the example/compare-markdown. I found it could be the difflib library cannot generate satisfied unified diff string for diff2html, it will show Files changed(0). If use jsdiff, Diff.createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader) the generated diff string could work I have forked your example here reproduce step:

git clone git@github.com:1846689910/react-gh-like-diff.git
cd example/compare-markdown
npm i # I use node 16 and npm 8
npm start

then you can check this code snippet if use formatedStr generated from jsdiff will work, but use formatedStr1 generated from difflib not working. Maybe I made a wrong guess. I wonder if you could take a look and make this library compatible for react>=17. This is a really useful library

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does "npm install" tell me "none is installed You must ...
You must install peer dependencies yourself. npm WARN @ionic/react@0.0.5 requires a peer of react-router-dom@^4.3.1 but none is installed.
Read more >
you must install peer dependencies yourself Code Example
npm WARN codelyzer@6.0.1 requires a peer of tslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
Read more >
npm Peer Dependencies - Fathom
If so, this post will improve your understanding. There are actually five different dependency types defined by npm: normal dependencies; dev dependencies; peer...
Read more >
What's the benefit of installing peer dependencies? What if I ...
You must install peer dependencies yourself. npm WARN theme-ui@0.2.52 requires a peer of u/mdx-js/react@^1.0.0 but none is installed.
Read more >
The Step-by-Step Guide to Understanding and Adopting npm 7
You must install peer dependencies yourself. npm WARN grommet-styles@0.2.0 requires a peer of react-dom@>= 16.4.1 but none is installed. You must ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found