Can't resolve markdown-it in Create-React-App
See original GitHub issueError:
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:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s not how
require
is supposed to work. Could you try usingnpm
instead ofyarn
?https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_addenda_package_manager_tips
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.