I'm re-writing the project and an interesting error occurred

I’ve been doing a general refactoring of the code I’ve written so far. Decided I’ll try a different approach and it’s been going splendidly so far. However, when I ran codecrafters test I got an error

[your_program] error: Cannot find module "./DataParser" from "/app/app/main.ts"
[tester::#BS1] dial tcp [::1]:6379: connect: connection refused

The module is still there, I’m just not sure why it’s looking for it in "/app/app/main.ts.
The path is codecrafters-redis-typescript/app/main.ts

Is it possibly an error due to the fact that I had to reinstall my code editor and now I’m not signed in to github? Does it even matter if I’m performing the tests with codecrafters’s testing tool?

I also got an error similar to this when I was trying to import a module. I wasn’t able to figure out the error though.

1 Like

@giraffe-529 tests are run remotely, and /app just happens to be where we store your code before tests are run.

We’ve got a guide on importing external files with TypeScript here: TypeScript - CodeCrafters. Does that help?

1 Like

Oh, something just struck me - @giraffe-529 are you on macOS by any chance? If so, could you check whether the import matches the exact file name’s casing?

macOS uses a case-insensitive filesystem by default, so you could do .. from "./dAtApArser" and things’d still work.

1 Like

Oh boy it was all my fault, it was all fine. I misspelled the name of the module. Sorry for making the thread, I feel so embarrassed. I promise to be more vigilant from now on.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.