remix: remix build doesn't create /build folder and remix-serve build fails

What version of Remix are you using?

1.6.4

Steps to Reproduce

  1. Run npx create-remix@latest
  2. Run npx remix build
  3. Run npx remix-serve build

Expected Behavior

Expected remix build to create the /build and the /public/build folders.

Actual Behavior

Actual: remix build does not create the /build folder and remix-serve build errors: Error: Cannot find module '/Users/.../repositoryName/build'

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18

Most upvoted comments

i haven’t tried to deploy this, but something like this may work in your remix.config.js

- server: process.env.NODE_ENV === "development" ? undefined : "./server.js",
+ server: !process.env.VERCEL ||process.env.NODE_ENV === "development" ? undefined : "./server.js",

if i remember correctly, vercel will set the VERCEL environment variable for you when building. otherwise you could also check for process.env.NODE_ENV === "development" instead