question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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'

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mcanshcommented, Jul 8, 2022

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

0reactions
andrecasalcommented, Jul 8, 2022

remix build will set NODE_ENV to production so the custom server is included.

Ah, the server.js can only be included in Vercel, so we need to make sure it’s excluded when creating the production build locally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug]: Fly deployment doesn't clear build directory #1622
Create Fly based project using npx create-remix@latest ... Open any .js.map file within the public/build directory on the server.
Read more >
Remix Build/Deploy Error - "bash: remix: command not found"
Failure when redeploying the currently deployed Remix application, which deployed successfully a couple of weeks ago. Error Log:
Read more >
remix-run/dev (CLI)
remix build. Builds your app for production. This command will set process.env.NODE_ENV to production and minify the output for deployment ...
Read more >
Is Remix the Next-Gen React Framework You Should Use?
Remix JS is a full stack web framework that lets you build fast, ... Since the HTML pages are loaded on the server,...
Read more >
Remix: A guide to the React framework taking on Next.js
Cleaning up the Remix app; Building a form and fetching the weather. How Remix's server-side rendering works with React apps; Does Remix ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found