close

[Solved] File name differs from already included file name only in casing on relative path with same casing

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error File name differs from already included file name only in casing on relative path with same casing in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Error File name differs from already included file name only in casing on relative path with same casing Occurs?

I am facing following this error.

Error TS1149: File name './scripts/State.ts' differs from already included file name '../frontend/scripts/State.ts' only in casing.

How To Solve File name differs from already included file name only in casing on relative path with same casing Error?

  1. How To Solve File name differs from already included file name only in casing on relative path with same casing Error?

    To Solve File name differs from already included file name only in casing on relative path with same casing Error the issue occurred when a file was quickly renamed from someFile.ts to SomeFile.ts. Restarting my IDE (Visual Studio Code) made the warning go away.

  2. File name differs from already included file name only in casing on relative path with same casing

    To Solve File name differs from already included file name only in casing on relative path with same casing Error the issue occurred when a file was quickly renamed from someFile.ts to SomeFile.ts. Restarting my IDE (Visual Studio Code) made the warning go away.

Solution 1

the error was in the import statement. The import statement had a capital letter instead of a small letter, which worked during development in Windows, but not when compiling for production.

wrong:

import {SomeClass} from '/some/path/SomeClass.ts';

correct:

import {SomeClass} from '/some/path/someClass.ts';

Solution 2

the issue occurred when a file was quickly renamed from someFile.ts to SomeFile.ts. Restarting my IDE (Visual Studio Code) made the warning go away.

Solution 3

You need to disable the "forceConsistentCasingInFileNames" in the tsconfig.json file.

So you should have something like that:

{
  "compilerOptions": {
    ...
    "forceConsistentCasingInFileNames": false,
    ...
  }
}

Solution 4

Restarting VS Code IDE didn’t work for me and I didn’t want to change config files. These are the steps that worked for me to resolve this problem:

  1. From VS Explorer, rename the problem file to a new name
  2. Change the component name to the new name inside the file
  3. Save the file
  4. Restart VS Code
  5. Rename the file back to the name I originally wanted
  6. Change the component name to match

It must be some kind of caching issue inside VS Code

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment