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.jsCannot 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

51

Best answers

51

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

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

Tag: React js

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

Tag: React js

[solved] Render/Show a custom option in Autocomplete Material UI?
Publish date: 2021-12-22 | Comments: 2

Tag: React js

Unexpected mix of '&&' and '||' Reactjs
Publish date: 2021-10-30 | Comments: 0

Tag: React js

TypeError: Cannot read properties of null (reading 'scrollTop') in jest
Publish date: 2022-09-08 | Comments: 1

Tag: React js

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

Tag: React js