Issue: "Cannot find module '/app/build/server/app/app/shopify.server'" during deployment

I’m deploying a Remix Shopify app on Render, and during the build process, I encountered the following error:

Error: Cannot find module ‘/app/build/server/app/app/shopify.server’ imported from /app/build/server/index.js
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:327:11)
at moduleResolve (node:internal/modules/esm/resolve:980:10)
at defaultResolve (node:internal/modules/esm/resolve:1206:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)
at ModuleWrap. (node:internal/modules/esm/module_job:76:39)
at link (node:internal/modules/esm/module_job:75:36)

Context:

  • The app works fine locally, but during deployment, it seems like the shopify.server.js file is either missing from the build directory or not being found in the expected path.
  • The file exists in my project under app/shopify.server.js, but the build process appears to be looking for it in /app/build/server/app/app/shopify.server.

I had similar issue. Take a look here, maybe you’ll find it helpful.