Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react or npm issue: Module not found: [CaseSensitivePathsPlugin] `...\react.js` does not match the corresponding path on disk `react`

I'm getting the following errors when I execute the npm start command on a react project.

Failed to compile.

Error in ./~/react-scroll-pagination/dist/index.js
Module not found: [CaseSensitivePathsPlugin] `C:\Users\timhu\Dev\MongoDbStitch\PlateSpace\Web\node_modules\React\react.js` does not match the corresponding path on disk `react`.

 @ ./~/react-scroll-pagination/dist/index.js 3:27-43

Error in ./~/react-scroll-pagination/dist/index.js
Module not found: [CaseSensitivePathsPlugin] `C:\Users\timhu\Dev\MongoDbStitch\PlateSpace\Web\node_modules\jQuery\dist\jquery.js` does not match the corresponding path on disk `jquery`.

 @ ./~/react-scroll-pagination/dist/index.js 3:45-62

I'm new to react - but from what I can tell it's a pathing issue where npm install adds modules into the node_modules folder, all with lowercase folder names, but the compiler resolves to folder names with mixed case paths.

How do I fix this? The code is from the MongoDb Stitch PlateSpace tutorial project

Do I updated the existing code (maybe the import statements) or is it a npm or react issue?

Thanks Tim

like image 925
The Huff Avatar asked Oct 20 '17 03:10

The Huff


2 Answers

I come across the same problem.

I replaced :
import React, {Component} from 'React', with :
import React, {Component} from 'react'.

React is case-sensitive, so be careful and good luck.

like image 82
Changyuan Chen Avatar answered Oct 28 '22 17:10

Changyuan Chen


For anyone facing this issue who is using CRA, I was getting this error and was not understanding why. My VS Code clearly showed the correctly named file, so I decided to check in the terminal:

ls -la [path/to/file/location]

I then actually saw that the file was in fact lowercase!

I renamed the file via the terminal and re-listed it to confirm:

mv src/create_page/createPage.jsx src/create_page/CreateDashboard.jsx
ls -la [path/to/file/location]

This fixed my issue, so at the end, I am not sure why this happened, maybe because my VS Code was not autosaving before I set the settings flag.

like image 2
thehme Avatar answered Oct 28 '22 16:10

thehme