user

Jo Micheal

10 Jun 2021

[Solved] Cannot find file: 'index.js' does not match the corresponding name on disk React js

React js

Hello there,
Please I am facing a big error in my new react js app 

Failed to compile.

./src/Homepage.js
Cannot find file: 'index.js' does not match the corresponding name on disk: '.\node_modules\React\react'.

and the screenshot is attached below,
Please help :(

Comments

Mohamed Atef

10 Jun 2021

Best Answer

best answer
githubgithubgithub

Welcome back, Jo
Nice to see you again, 

This is a common error that happens for beginners so all you need to do is just fix the name of react library at the first line so it should be react with small r instead of React 

import React from 'react';
//Instead of 
import React from 'React';

Replies

Jo Micheal

10 Jun 2021

Works fine!! thanks :) 

Stephen Jones

21 Sep 2021

I have the same error but it is not because of the index.js import statement which is:

 import React from 'react';

The actual message suggests an issue with node modules:

Cannot find file: 'index.js' does not match the corresponding name on disk: './node_modules/React/react'.

There isn't a reference to React/react in the node modules

any other suggestions?  This is driving me crazy!

 

Replies

Jo Micheal

21 Sep 2021

Hey Stephen i suggest if you re-installed the reactjs

npx create-react-app my-app 
cd my-app 
npm start

or you can update the npm packages by 

npm update

let me know if you solved the issue

Best regards

yash dikshit

26 Nov 2021

i am applying your method but same error occured

yash dikshit

26 Nov 2021

./src/component/Navbar.js

Cannot find file: 'index.js' does not match the corresponding name on disk: '.\node_modules\Prop-types\prop-types'.

 

Replies

Mohamed Atef

26 Nov 2021

githubgithubgithub

What is the code which you are using? Can you try 

import PropTypes from 'prop-types';

& make sure there is no { }
otherwise please make sure that the package is already there & if it's there in the node_modules you can use diffferent version

© 2024 Copyrights reserved for web-brackets.com