Reputation: 139
I am getting the below error on a page that is stopping it being rendered and after checking other similar errors I have double checked the import is correct and the node_modules react index file is installed.
What else could be causing this? I have had linting issues yesterday out of nowhere that I thought had fixed themselves.
The file this refers to should be node_modules/React/react.indexjs but on my system is node_modules/react.index.js. I haven't changed this myself so i'm not sure where it has come from. I have also removed any code that was added to this file which could of been causing it.
Cannot find file: 'index.js' does not match the corresponding name on disk: '.\node_modules\React\react'
Upvotes: 7
Views: 18630
Reputation: 81
1.diveLogTable.component.js instead, you should do DiveLogTable.Component.js OR DiveLogTable.js.
2.Ensure you have imported React in all the files that have jsx. Like, import React from 'react' It might also be required by your build system that files with jsx have .jsx or .tsx extensions (not just .js / .ts).
3.Ensure that file names that are referenced in your code are matching actual file names in a filesystem. There could be issues if file names had changes in capitalization. Keeping file names in lowercase might be a good idea to avoid such sort of problems.
Upvotes: 1
Reputation: 990
This happens due to case sensitivity. Check if the file name is exactly the same in the same case.
Eg:
Cannot find file: 'CheckBox.js'
Check if the filename is exactly CheckBox.js not Checkbox.js
Upvotes: 4
Reputation: 27
try creating the index.js in the src folder, i'm sure you created it outside the src folder.
Upvotes: 0
Reputation: 17654
This happens when you import react like this
import React from "React"
notice the capital R
instead, you should do :
import React from "react"
( with a small r
)
Upvotes: 13