Skip to content

Module not found: Can't resolve 'property-information/hast-to-react.json' #617

New issue

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

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

Already on GitHub? # to your account

Closed
foucdeg opened this issue Jul 20, 2021 · 4 comments
Closed
Labels
🙋 no/question This does not need any changes

Comments

@foucdeg
Copy link

foucdeg commented Jul 20, 2021

Subject of the issue

When running my app with a newly installed react-markdown 6.0.2, I get the following warning in the console, and my build fails:

Module not found: Can't resolve 'property-information/hast-to-react.json'

Your environment

  • OS: Ubunt / frontend running inside Docker Alpine
  • Packages: react-markdown 6.0.2
  • Env: Node 14 + npm

Steps to reproduce

  • npm install react-markdown --save
  • Import ReactMarkdown into a component
  • npm start

Expected behavior

My app should build properly.

Actual behavior

My app doesn't build.

In node_modules/property-information, there is indeed no file named 'hast-to-react.json'.

@foucdeg foucdeg added 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Jul 20, 2021
@ChristianMurphy
Copy link
Member

ChristianMurphy commented Jul 20, 2021

@foucdeg could you try clearing node_modules and running npm install again?
The file exists in the published package https://unpkg.com/browse/property-information@5.6.0/hast-to-react.json

The most likely scenarios of what could have happened include:

  1. Your build tool isn't configured to import json files (please share what build tool you are using)
  2. a network issue happened and npm was unable to download it
  3. a script/process on your machine deleted the file
  4. a selective resolution has been set that overrides the version of property-information

If you are looking for an example of a fully setup environment, see this codesandbox with create-react-app as the build tool https://codesandbox.io/s/react-markdown-debug-forked-xjk8q

@ChristianMurphy ChristianMurphy added 🙋 no/question This does not need any changes and removed 🐛 type/bug This is a problem 🙉 open/needs-info This needs some more info labels Jul 20, 2021
@harrygr
Copy link

harrygr commented Jul 29, 2021

I have the same problem (react-markdown 6.0.2).

I can see the version of property-information that was installed as a dependency of react-markdown is 5.1.0 (not 5.6.0 as in your example. We can see that the file does not exist in 5.1.0: https://unpkg.com/browse/property-information@5.1.0

$ yarn why property-information                                             
yarn why v1.22.10
[1/4] 🤔  Why do we have the module "property-information"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "property-information@5.1.0"
info Reasons this module exists
   - "react-markdown" depends on it
   - Hoisted from "react-markdown#property-information"
   - Hoisted from "@svgr#webpack#@svgr#plugin-jsx#rehype-parse#hast-util-from-parse5#property-information"
   - Hoisted from "@svgr#webpack#@svgr#plugin-jsx#rehype-parse#hast-util-from-parse5#hastscript#property-information"
info Disk size without dependencies: "156KB"
info Disk size with unique dependencies: "192KB"
info Disk size with transitive dependencies: "192KB"
info Number of shared dependencies: 1
✨  Done in 0.46s.

Perhaps react-markdown should declare ^5.3.0 for property-information as this seems to be the earliest version that includes this file.

@wooorm
Copy link
Member

wooorm commented Jul 29, 2021

@harrygr could you try and follow Christian’s advise on updating dependencies?

@harrygr
Copy link

harrygr commented Jul 29, 2021

@wooorm I did try that advice with no success. However I declared a selective resolution in my package.json which fixed it:

"resolutions": {
   "property-information": "^5.6.0"
 }

I think the dependency version for property-information should be updated in this repo though

wooorm added a commit that referenced this issue Jul 30, 2021
thelonehegelian added a commit to symbiont-me/symbiont-frontend that referenced this issue Apr 6, 2024
there is a dep version issue with syntax highliter packer, this is supposed to fix it: remarkjs/react-markdown#617
thelonehegelian added a commit to symbiont-me/symbiont that referenced this issue Sep 17, 2024
there is a dep version issue with syntax highliter packer, this is supposed to fix it: remarkjs/react-markdown#617
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🙋 no/question This does not need any changes
Development

No branches or pull requests

4 participants