user image

Jo Micheal
Published in : 2021-06-10

[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 :(

web-brackets.com

Comments

Mohamed Atef Date : 2021-06-10

Best answers

46

Best answers

46

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';

Jo Micheal Date : 2021-06-10

Works fine!! thanks :) 

Stephen Jones Date : 2021-09-21

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!

 

Jo Micheal Date : 2021-09-21

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 Date : 2021-11-26

i am applying your method but same error occured

yash dikshit Date : 2021-11-26

./src/component/Navbar.js

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

 

Mohamed Atef Date : 2021-11-26

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

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Export 'Switch' (imported as 'Switch') was not found in 'react-router-dom'
Publish date: 2022-04-02 | Comments: 2

Tag: React js

Could not be processed as an image because it has an invalid content type
Publish date: 2021-12-08 | Comments: 0

Tag: React js

React Redux : Connect is not called
Publish date: 2022-03-02 | Comments: 1

Tag: React js

[solved] Expected a conditional expression and instead saw an assignment
Publish date: 2021-11-29 | Comments: 0

Tag: React js

[solved] useEffect is repeating the request Reactjs
Publish date: 2022-04-07 | Comments: 2

Tag: React js

How to update React router without Re-render?
Publish date: 2021-11-22 | Comments: 2

Tag: React js

npm install @mui/material returns error
Publish date: 2022-04-02 | Comments: 1

Tag: React js