Next.js Discord

Discord Forum

Error when running test cases with Jest: "ENOENT: no such file or directory"

Unanswered
Philippine Crocodile posted this in #help-forum
Open in Discord
Avatar
Philippine CrocodileOP
Hey everyone,

I'm encountering an issue while running test cases with Jest. I'm getting the following error:

Error: ENOENT: no such file or directory, open '/home/vsts/work/1/s/node_modules/@sanity/image-url/src/builder.ts'

It seems like Jest is looking for the file src/builder.ts inside the @sanity/image-url package, which doesn't exist in my local node_modules folder (and shouldn't since it's a compiled package).

Here's what I've tried so far:

Verified that I'm importing @sanity/image-url correctly in my code.
Double-checked that I'm not referencing any files in the src/ directory.
Reinstalled node_modules and cleared the cache.
Has anyone faced a similar issue with Jest and @sanity/image-url? Any advice on how to resolve this would be greatly appreciated!

0 Replies