File name … differs from already included file name … only in casing

泪湿孤枕 提交于 2020-05-29 02:37:00


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?


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.


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

i was importing my component like this :




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.