The Huff
The Huff

Reputation: 485

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

Upvotes: 11

Views: 31979

Answers (6)

user1419778
user1419778

Reputation: 92

For me the issue was the files on my disk was named filename.js, but my imports were doing this import thing from 'fileName.js'.

Renaming the file from filename.js to fileName.js on disk fixed the issue.

Upvotes: 0

Tomás
Tomás

Reputation: 129

Solved it... I haven't import all the libraries. So, I went to my root folder and excecute.
npm install
then
npm start

Upvotes: 1

Changyuan Chen
Changyuan Chen

Reputation: 318

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.

Upvotes: 13

thehme
thehme

Reputation: 2886

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.

Upvotes: 2

venky royal
venky royal

Reputation: 2250

For this error :

import React from 'react'; in your index.js file . For this error : Error in ./~/react-scroll-pagination/dist/index.js Module not found: [CaseSensitivePathsPlugin]C:\Users\timhu\Dev\MongoDbStitch\PlateSpace\Web\node_modules\jQuery\dist\jquery.jsdoes not match the corresponding path on diskjquery.

replace this code import React from 'react'; in your index.js file .

For this error :

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

replace the code with import Jquery from './jquery';

Don't worry this errors will shows pretty commonly its because react is a case sensitive.

Upvotes: 0

kfroemming
kfroemming

Reputation: 321

You may be executing the npm install / start inside of the wrong folder. I would delete the current directory and make sure to run the install in:

cd /stitch-examples/helloworld/react-example/

then

npm install
npm start

Upvotes: 0

Related Questions