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.

Can't resolve markdown-it in Create-React-App

See original GitHub issue

Error: Module not found: Can't resolve 'markdown-it' in 'project/node_modules/markdownlint/lib'

Steps to reproduce: npx create-react-app project cd project yarn add markdownlint yarn && yarn start Go to src/App.js and add the line import markdownlint from 'markdownlint'

node version v14.4.0 react version v17.0.1

The issue seems to be of the absolute import. In markdownlint.js, changing the absolute import const markdownIt = require("markdown-it"); to a relative import const markdownIt = require("../node_modules/markdown-it/index.js"); seems to fix the issue.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DavidAnsoncommented, Jan 1, 2021

That’s not how require is supposed to work. Could you try using npm instead of yarn?

https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_addenda_package_manager_tips

0reactions
hamza1220commented, Jan 3, 2021

Removing that did work for me but since packages are downloaded fresh in the production environment, I still won’t be able to use the package. I’d really appreciate it if you could find a way around this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Site deploy error - Can't resolve markdown file - Support
In my project, I use 'react-markdown' to display some markdown files on component. When I deploy on Netlify, I got this error.
Read more >
react-markdown - npm
This package is a React component that can be given a string of markdown that it'll safely render to React elements. You can...
Read more >
How to load an .md file on build when using create-react-app ...
I am trying to get load a markdown file to be loaded on build. I have setup a create-react-app that uses Typescript and...
Read more >
How to safely render Markdown using react-markdown
Markdown language was designed to help you create editorial content easily. That's why it only includes basic tags. react-markdown does not ...
Read more >
React Markdown: A Thorough Guide With Markdown Examples
By default, React does not support Markdown syntax, it requires a Markdown library to convert the Markdown syntax into a React element.
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