If the error occurs even if you have the package installed, then the fixes suggested in this article can help you out. When you get the “cannot find module” error, or “module not found”, it means you’ve not installed the package you’re trying to use. install all packages again by running npm install.clean up the NPM cache by running npm cache clean -force.delete file by running rm -f package-lock.json.delete the node modules folder by running rm -rf node_modules.If you install the package but you still get the error, then follow the steps below: Once I install the package and run the app, everything should successfully compile: I’ll do that by running yarn add react-icons. In my case, I need to install the react-icons package so the freeCodeCamp icon can be resolved. To fix the error, you need to install the package that is absent in your project directory – npm install package-name or yarn add package-name. In my case, I got it like this "Module not found: Error: Can't resolve 'react-icons/fa' in 'C:\Users\user\Desktop\Projects\Address Locator\address-locator\src'". The module (package) not found is always specified in the format "Module not found: Error: Can't resolve 'package name' in 'project directory". Thankfully the plug-in is opt in per workspace, so it happily falls back to json if that’s there. As node expects package.json on disk for some stuff. It works much better than I expected, though I mostly use it on non-node stuff. If you get this error, the solution is always in the error. yarn plugin import The yaml plug-in sits in between the file system. How to Fix the "cannot find module" Error I’m getting the error because I’m trying to import the freeCodeCamp icon from the react-icons package, which I don’t have installed. In the screenshot below, you can see that I’m getting the error:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |