Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RR7 with cross-env and Docker #12617

Open
martinmalia opened this issue Dec 22, 2024 · 4 comments
Open

RR7 with cross-env and Docker #12617

martinmalia opened this issue Dec 22, 2024 · 4 comments
Labels

Comments

@martinmalia
Copy link

I'm using React Router as a...

framework

Reproduction

bunx create-react-router@latest my-react-router-app
docker build -f Dockerfile.bun -t my-app .
docker run -p 3000:3000 my-app

System Info

System:
    OS: macOS 15.1.1
    CPU: (16) arm64 Apple M3 Max
    Memory: 71.24 GB / 128.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.2.0 - ~/Library/pnpm/node
    npm: 10.9.0 - ~/Library/pnpm/npm
    pnpm: 9.13.2 - ~/Library/pnpm/pnpm
    bun: 1.1.38 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 131.1.73.97
    Safari: 18.1.1
  npmPackages:
    @react-router/dev: ^7.1.0 => 7.1.0 
    @react-router/node: ^7.1.0 => 7.1.0 
    @react-router/serve: ^7.1.0 => 7.1.0 
    react-router: ^7.1.0 => 7.1.0 
    vite: ^5.4.11 => 5.4.11

Used Package Manager

pnpm

Expected Behavior

Prior to RR implementing cross-env everything worked as expected and we got a running docker container straight from default template.

Actual Behavior

running in Docker fails with > cross-env NODE_ENV=production react-router-serve ./build/server/index.js

sh: cross-env: not found
 ELIFECYCLE  Command failed.

@timdorr
Copy link
Member

timdorr commented Dec 22, 2024

cross-env needs to be a regular dependency (not a devDep) for this to work. If you install it as such, that should fix the issue.

I'm not 100% sure why it's included, since the base image is a Linux-based system and cross-env is for Windows compat. You can also just remove it from your package scripts entirely.

@martinmalia
Copy link
Author

cross-env needs to be a regular dependency (not a devDep) for this to work. If you install it as such, that should fix the issue.

I'm not 100% sure why it's included, since the base image is a Linux-based system and cross-env is for Windows compat. You can also just remove it from your package scripts entirely.

Yeah, I think I tried moving it out of dev deps and there's still issues with that. I just removed from mine and changed the scripts and it works fine. It seems they added it across all templates though so I'm assuming it's something they are moving to for whatever reason...

@timdorr
Copy link
Member

timdorr commented Dec 22, 2024

It's just for Windows compatible when not in Docker. That makes sense, but I'm not sure the Dockerfile is correct as-is.

@MoSattler
Copy link

It's just for Windows compatible when not in Docker. That makes sense, but I'm not sure the Dockerfile is correct as-is.

Hey @timdorr - we just started using a fresh template for RR7, and wanted to rely on the Docker image. What parts in your view might not be ready?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants