12

I’m getting the following error in VSCode in my Angular 6 application:

ERROR in src/app/providers/dynamic-data/dynamic-data.service.ts(5,26): error TS1149: File name '/Users/gibranshah/repos/eva/EVA/src/app/model/endpoint.ts' differs from already included file name '/Users/gibranshah/repos/eva/EVA/src/app/model/Endpoint.ts' only in casing.

It’s telling me that this line in dynamic-data.service.ts:

import { Endpoint } from '../../model/endpoint';

…refers to a file whose name is Endpoint.ts. But there is no such file. Instead, I have endpoint.ts. endpoint.ts contains a class like this:

export class Endpoint {
…
}

endpoint.ts might have been named ‘Endpoint.ts’ at one point, put it’s not anymore.

I tried to do a find for ‘Endpoint.ts’ but came up short:

M0168169000:gibranshah gibranshah$ find * -name "Endpoint.ts"
M0168169000:gibranshah gibranshah$ 

Does VSCode cache files? Is it possible it’s using a cached version of Endpoint.ts? How do I fix this problem?

Gibran Shah
  • 871
  • 3
  • 15
  • 34
  • I used this [solution]: https://stackoverflow.com/questions/10523849/how-do-you-change-the-capitalization-of-filenames-in-git – Wilmar Zapata May 20 '23 at 02:15

6 Answers6

11

I had a similar issue and solved it by closing the folder, then on the Recent workspaces list click More at the bottom, and from the list click the 'x' (remove) button to remove the workspace. Then, after loading the project's folder, it build normally. So probably there is some cache and that is probably one way to clear it.

pevgeniev
  • 389
  • 2
  • 13
8

i had this issue and it was a directory name capitalization problem.

i was importing my component like this :

../proxies/test.component

../Proxies/test.component
MajiD
  • 2,420
  • 1
  • 22
  • 32
4

I have the same issue, and just discovered that for some reason, in some ts file it is called using capitalize letter, then I renamed it for lowercase and it works.

You can try also removing this model ts file and creating again with angular-CLI.

Dody
  • 608
  • 7
  • 19
4

I solved it by restarting typescript server:

Make sure that you have a TypeScript file open, press Ctrl+Shift+P (or Cmd+Shift+P on macOS) to open the Command Palette and type restart, then select the command "TypeScript: Restart TS server".

Source

len
  • 376
  • 2
  • 19
1

It's all about the path of files, make sure it is case-sensitive

Moamen
  • 440
  • 3
  • 10
0

In my case, when renaming the folder I made a capitalization error, then corrected it. Somehow, visual studio created a second directory with the bad capitalization. That second directory was invisible in VS, but when I tracked it down manually I was able to delete it. After restarting VS code to force it to recognize the correct folder, I was able to get it working again.

Paula T
  • 1,212
  • 11
  • 13