Error: Failed to load url ~/db.server (resolved id: ~/db.server)... Does the file exist?

Hi all, I’m new to shopify app development and I’m running into this error when running shopify app dev with a newly created app:

[vite] Pre-transform error:
Failed to load url ~/db.server (resolved id: ~/db.server) in
/Users/.../app/shopify.server.js.
 Does the file exist?

I followed the steps in the documentation — created a partner account, created a development store, etc. I have the latest version of Shopify CLI installed. Can anyone help assist? Any additional resources to help me get started would be greatly appreciated too. Thank you!

Hi Lauryyy, the dev store URL is remix-tutorials.myshopify.com (not sure if this is the info you’re looking for). The “Failed to load…” initially error pops up in the terminal when I run “shopify app dev” after creating the application with “npm init shopify” — I haven’t touched any of the files. When I go to the Preview URL, I then see the overlay with that error.

Hey

Did you find a solution to this? I am facing the same issue. I think there’s a bug with the latest shopify CLI install?

Hi Anirudh, yes I found a solution. I changed the “~/” to “./” in the import statement, depending on where the imported file is located within the directories

(ex. import prisma from “~/db.server” → import prisma from “./db.server”)