How to resolve failed to compile error

I am working on ravenous project but while working on it I’m getting Failed to compile error
it says ".src/index.js
Module not found: can’t resolve ‘./components’ in ‘G:\React_Programs\ravenous\src’

Hey there and welcome to the forums! :slightly_smiling_face:

I have little experience with react and probably can’t help out much here, but there are others who may be able to.

Could you post the code you were working with and a link to the lesson you are on?
Please post it formatted as this preserves indentation, makes it much easier to read, and keeps it ready to be copy/pasted to an IDE.
To format your code, simply press this button:

Than copy/paste your code between the backticks:


Also I moved this post over to the #get-help:React category.

1 Like

In your index.js you should have two lines of code importing App.css (css file) and App.js (the main App component). I think you just have the ‘components’ directory in your import path but not the component-subdirectory or files. These 2 lines of code in index.js should look something like this (also check that these files are present in the right place):

import './components/App/App.css';
import App from './components/App/App';
1 Like

the error still exists!

Keep in mind that you can use the feature in VS-code that helps you “select” folders and file-names when typing in an import (this minimizes the risk of having a module not found error). Also, keep in mind that Windows uses backslash while Mac and Linux uses forward-slash in the paths. I am not sure that is the issue but worth considering. If you are using Windows then something like Git-Bash (or WSL2 which I use) can make it a better web development environment if you are not already using it (more similar to the server where sites are hosted).

1 Like

Please post your code, as @8-bit-gaming explained. :slight_smile: