`remix-serve build` not found when deploying a new remix app

I’m trying to deploy a remix app, I’m getting the following errors:

023-07-18T14:08:50.509 app[4d891247b44e48] yyz [info] [ 2.281908] reboot: Restarting system

2023-07-18T14:08:50.657 runner[4d891247b44e48] yyz [info] machine did not have a restart policy, defaulting to restart

2023-07-18T14:08:51.739 app[4d891247b44e48] yyz [info] INFO Starting init (commit: 1d1821d)...

2023-07-18T14:08:51.760 app[4d891247b44e48] yyz [info] INFO Preparing to run: `docker-entrypoint.sh pnpm run start` as root

2023-07-18T14:08:51.769 app[4d891247b44e48] yyz [info] INFO [fly api proxy] listening at /.fly/api

2023-07-18T14:08:51.777 app[4d891247b44e48] yyz [info] 2023/07/18 14:08:51 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:08:52.489 app[4d891247b44e48] yyz [info] > templecoding-site@2.0.0 start /app

2023-07-18T14:08:52.489 app[4d891247b44e48] yyz [info] > remix-serve build

2023-07-18T14:08:52.495 app[4d891247b44e48] yyz [info] sh: 1: remix-serve: not found

2023-07-18T14:08:52.497 app[4d891247b44e48] yyz [info]  ELIFECYCLE  Command failed.

2023-07-18T14:08:52.770 app[4d891247b44e48] yyz [info] INFO Main child exited normally with code: 1

2023-07-18T14:08:52.770 app[4d891247b44e48] yyz [info] INFO Starting clean up.

2023-07-18T14:08:52.771 app[4d891247b44e48] yyz [info] WARN hallpass exited, pid: 238, status: signal: 15 (SIGTERM)

2023-07-18T14:08:52.777 app[4d891247b44e48] yyz [info] 2023/07/18 14:08:52 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:08:53.772 app[4d891247b44e48] yyz [info] [ 2.282549] reboot: Restarting system

2023-07-18T14:08:53.939 runner[4d891247b44e48] yyz [info] machine did not have a restart policy, defaulting to restart

2023-07-18T14:08:55.299 app[4d891247b44e48] yyz [info] INFO Starting init (commit: 1d1821d)...

2023-07-18T14:08:55.320 app[4d891247b44e48] yyz [info] INFO Preparing to run: `docker-entrypoint.sh pnpm run start` as root

2023-07-18T14:08:55.327 app[4d891247b44e48] yyz [info] INFO [fly api proxy] listening at /.fly/api

2023-07-18T14:08:55.335 app[4d891247b44e48] yyz [info] 2023/07/18 14:08:55 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:08:56.052 app[4d891247b44e48] yyz [info] > templecoding-site@2.0.0 start /app

2023-07-18T14:08:56.052 app[4d891247b44e48] yyz [info] > remix-serve build

2023-07-18T14:08:56.059 app[4d891247b44e48] yyz [info] sh: 1: remix-serve: not found

2023-07-18T14:08:56.061 app[4d891247b44e48] yyz [info]  ELIFECYCLE  Command failed.

2023-07-18T14:08:56.328 app[4d891247b44e48] yyz [info] INFO Main child exited normally with code: 1

2023-07-18T14:08:56.328 app[4d891247b44e48] yyz [info] INFO Starting clean up.

2023-07-18T14:08:56.329 app[4d891247b44e48] yyz [info] WARN hallpass exited, pid: 238, status: signal: 15 (SIGTERM)

2023-07-18T14:08:56.334 app[4d891247b44e48] yyz [info] 2023/07/18 14:08:56 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:08:57.330 app[4d891247b44e48] yyz [info] [ 2.281268] reboot: Restarting system

2023-07-18T14:08:57.469 runner[4d891247b44e48] yyz [info] machine did not have a restart policy, defaulting to restart

2023-07-18T14:08:59.571 app[4d891247b44e48] yyz [info] INFO Starting init (commit: 1d1821d)...

2023-07-18T14:08:59.592 app[4d891247b44e48] yyz [info] INFO Preparing to run: `docker-entrypoint.sh pnpm run start` as root

2023-07-18T14:08:59.600 app[4d891247b44e48] yyz [info] INFO [fly api proxy] listening at /.fly/api

2023-07-18T14:08:59.608 app[4d891247b44e48] yyz [info] 2023/07/18 14:08:59 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:09:00.343 app[4d891247b44e48] yyz [info] > templecoding-site@2.0.0 start /app

2023-07-18T14:09:00.343 app[4d891247b44e48] yyz [info] > remix-serve build

2023-07-18T14:09:00.350 app[4d891247b44e48] yyz [info] sh: 1: remix-serve: not found

2023-07-18T14:09:00.352 app[4d891247b44e48] yyz [info]  ELIFECYCLE  Command failed.

2023-07-18T14:09:00.601 app[4d891247b44e48] yyz [info] INFO Main child exited normally with code: 1

2023-07-18T14:09:00.602 app[4d891247b44e48] yyz [info] INFO Starting clean up.

2023-07-18T14:09:00.603 app[4d891247b44e48] yyz [info] WARN hallpass exited, pid: 238, status: signal: 15 (SIGTERM)

2023-07-18T14:09:00.608 app[4d891247b44e48] yyz [info] 2023/07/18 14:09:00 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:09:01.603 app[4d891247b44e48] yyz [info] [ 2.290117] reboot: Restarting system

2023-07-18T14:09:01.773 runner[4d891247b44e48] yyz [info] machine did not have a restart policy, defaulting to restart

2023-07-18T14:09:08.600 app[4d891247b44e48] yyz [info] INFO Starting init (commit: 1d1821d)...

2023-07-18T14:09:08.621 app[4d891247b44e48] yyz [info] INFO Preparing to run: `docker-entrypoint.sh pnpm run start` as root

2023-07-18T14:09:08.628 app[4d891247b44e48] yyz [info] INFO [fly api proxy] listening at /.fly/api

2023-07-18T14:09:08.636 app[4d891247b44e48] yyz [info] 2023/07/18 14:09:08 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:09:09.355 app[4d891247b44e48] yyz [info] > templecoding-site@2.0.0 start /app

2023-07-18T14:09:09.355 app[4d891247b44e48] yyz [info] > remix-serve build

2023-07-18T14:09:09.361 app[4d891247b44e48] yyz [info] sh: 1: remix-serve: not found

2023-07-18T14:09:09.363 app[4d891247b44e48] yyz [info]  ELIFECYCLE  Command failed.

2023-07-18T14:09:09.629 app[4d891247b44e48] yyz [info] INFO Main child exited normally with code: 1

2023-07-18T14:09:09.629 app[4d891247b44e48] yyz [info] INFO Starting clean up.

2023-07-18T14:09:09.630 app[4d891247b44e48] yyz [info] WARN hallpass exited, pid: 238, status: signal: 15 (SIGTERM)

2023-07-18T14:09:09.636 app[4d891247b44e48] yyz [info] 2023/07/18 14:09:09 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:09:10.630 app[4d891247b44e48] yyz [info] [ 2.284292] reboot: Restarting system

2023-07-18T14:09:10.790 runner[4d891247b44e48] yyz [info] machine did not have a restart policy, defaulting to restart

2023-07-18T14:09:18.354 app[4d891247b44e48] yyz [info] INFO Starting init (commit: 1d1821d)...

2023-07-18T14:09:18.375 app[4d891247b44e48] yyz [info] INFO Preparing to run: `docker-entrypoint.sh pnpm run start` as root

2023-07-18T14:09:18.382 app[4d891247b44e48] yyz [info] INFO [fly api proxy] listening at /.fly/api

2023-07-18T14:09:18.391 app[4d891247b44e48] yyz [info] 2023/07/18 14:09:18 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:09:19.106 app[4d891247b44e48] yyz [info] > templecoding-site@2.0.0 start /app

2023-07-18T14:09:19.106 app[4d891247b44e48] yyz [info] > remix-serve build

2023-07-18T14:09:19.112 app[4d891247b44e48] yyz [info] sh: 1: remix-serve: not found

2023-07-18T14:09:19.114 app[4d891247b44e48] yyz [info]  ELIFECYCLE  Command failed.

2023-07-18T14:09:19.383 app[4d891247b44e48] yyz [info] INFO Main child exited normally with code: 1

2023-07-18T14:09:19.384 app[4d891247b44e48] yyz [info] INFO Starting clean up.

2023-07-18T14:09:19.385 app[4d891247b44e48] yyz [info] WARN hallpass exited, pid: 238, status: signal: 15 (SIGTERM)

2023-07-18T14:09:19.390 app[4d891247b44e48] yyz [info] 2023/07/18 14:09:19 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:09:20.385 app[4d891247b44e48] yyz [info] [ 2.280152] reboot: Restarting system

2023-07-18T14:09:20.544 runner[4d891247b44e48] yyz [info] machine did not have a restart policy, defaulting to restart

2023-07-18T14:09:44.551 app[4d891247b44e48] yyz [info] INFO Starting init (commit: 1d1821d)...

2023-07-18T14:09:44.571 app[4d891247b44e48] yyz [info] INFO Preparing to run: `docker-entrypoint.sh pnpm run start` as root

2023-07-18T14:09:44.578 app[4d891247b44e48] yyz [info] INFO [fly api proxy] listening at /.fly/api

2023-07-18T14:09:44.586 app[4d891247b44e48] yyz [info] 2023/07/18 14:09:44 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:09:45.307 app[4d891247b44e48] yyz [info] > templecoding-site@2.0.0 start /app

2023-07-18T14:09:45.307 app[4d891247b44e48] yyz [info] > remix-serve build

2023-07-18T14:09:45.313 app[4d891247b44e48] yyz [info] sh: 1: remix-serve: not found

2023-07-18T14:09:45.315 app[4d891247b44e48] yyz [info]  ELIFECYCLE  Command failed.

2023-07-18T14:09:45.580 app[4d891247b44e48] yyz [info] INFO Main child exited normally with code: 1

2023-07-18T14:09:45.580 app[4d891247b44e48] yyz [info] INFO Starting clean up.

2023-07-18T14:09:45.581 app[4d891247b44e48] yyz [info] WARN hallpass exited, pid: 238, status: signal: 15 (SIGTERM)

2023-07-18T14:09:45.586 app[4d891247b44e48] yyz [info] 2023/07/18 14:09:45 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:09:46.581 app[4d891247b44e48] yyz [info] [ 2.277172] reboot: Restarting system

2023-07-18T14:09:46.733 runner[4d891247b44e48] yyz [info] machine did not have a restart policy, defaulting to restart

2023-07-18T14:09:59.684 app[4d891247b44e48] yyz [info] INFO Starting init (commit: 1d1821d)...

2023-07-18T14:09:59.704 app[4d891247b44e48] yyz [info] INFO Preparing to run: `docker-entrypoint.sh pnpm run start` as root

2023-07-18T14:09:59.712 app[4d891247b44e48] yyz [info] INFO [fly api proxy] listening at /.fly/api

2023-07-18T14:09:59.720 app[4d891247b44e48] yyz [info] 2023/07/18 14:09:59 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:10:00.438 app[4d891247b44e48] yyz [info] > templecoding-site@2.0.0 start /app

2023-07-18T14:10:00.438 app[4d891247b44e48] yyz [info] > remix-serve build

2023-07-18T14:10:00.444 app[4d891247b44e48] yyz [info] sh: 1: remix-serve: not found

2023-07-18T14:10:00.446 app[4d891247b44e48] yyz [info]  ELIFECYCLE  Command failed.

2023-07-18T14:10:00.712 app[4d891247b44e48] yyz [info] INFO Main child exited normally with code: 1

2023-07-18T14:10:00.712 app[4d891247b44e48] yyz [info] INFO Starting clean up.

2023-07-18T14:10:00.713 app[4d891247b44e48] yyz [info] WARN hallpass exited, pid: 238, status: signal: 15 (SIGTERM)

2023-07-18T14:10:00.719 app[4d891247b44e48] yyz [info] 2023/07/18 14:10:00 listening on [fdaa:0:62a6:a7b:174:8606:b71d:2]:22 (DNS: [fdaa::3]:53)

2023-07-18T14:10:01.715 app[4d891247b44e48] yyz [info] [ 2.283216] reboot: Restarting system

2023-07-18T14:10:01.878 runner[4d891247b44e48] yyz [info] machine has reached its max restart count (10) 

the fly.toml file looks like:

# fly.toml app configuration file generated for thecodingtemple on 2023-07-18T09:58:03-04:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "thecodingtemple"
primary_region = "yyz"

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ["app"]

and the Dockerfile

# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.16.0
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="Remix"

# Remix app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV=production

ARG PNPM_VERSION=8.4.0
RUN npm install -g pnpm@$PNPM_VERSION


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
    apt-get install -y python-is-python3 pkg-config build-essential 

# Install node modules
COPY --link .npmrc package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod=false

# Copy application code
COPY --link . .

# Build application
RUN pnpm run build

# Remove development dependencies
RUN pnpm prune --prod


# Final stage for app image
FROM base

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "pnpm", "run", "start" ]

why would it not find remix-serve? Does it make a difference that I am deploying from a branch other than main ?

Possibly a bug with dockerfile-node as I’ve not extensively tested pnpm support.

Can you share your package.json file?

Sure:

{
    "name": "templecoding-site",
    "version": "2.0.0",
    "private": true,
    "sideEffects": false,
    "dependencies": {
        "@mapbox/rehype-prism": "^0.8.0",
        "@mdx-js/esbuild": "^2.3.0",
        "@netlify/functions": "^1.6.0",
        "@remix-run/css-bundle": "^1.18.1",
        "@remix-run/netlify": "^1.18.1",
        "@remix-run/node": "^1.18.1",
        "@remix-run/react": "^1.18.1",
        "clsx": "^2.0.0",
        "cross-env": "^7.0.3",
        "esbuild": "^0.18.13",
        "fast-glob": "^3.3.0",
        "isbot": "^3.6.12",
        "mdx-bundler": "^9.2.1",
        "react": "^18.2.0",
        "react-dom": "^18.2.0",
        "remark-mdx-images": "^2.0.0",
        "remix-typedjson": "^0.1.7"
    },
    "keywords": [
        "thiago temple",
        "temple coding",
        "the coding temple",
        "blog"
    ],
    "scripts": {
        "build": "remix build",
        "deploy": "fly deploy --remote-only",
        "dev": "remix dev",
        "start": "remix-serve build",
        "typecheck": "tsc"
    },
    "devDependencies": {
        "@flydotio/dockerfile": "^0.3.3",
        "@remix-run/dev": "^1.18.1",
        "@remix-run/eslint-config": "^1.18.1",
        "@remix-run/serve": "^1.18.1",
        "@types/eslint": "^8.44.0",
        "@types/mapbox__rehype-prism": "^0.8.0",
        "@types/react": "^18.2.15",
        "@types/react-dom": "^18.2.7",
        "eslint": "^8.45.0",
        "prettier": "^3.0.0",
        "prettier-plugin-organize-imports": "^3.2.3",
        "prettier-plugin-tailwindcss": "^0.4.1",
        "remix-development-tools": "^1.0.6",
        "tailwindcss": "^3.3.3",
        "typescript": "^5.1.6"
    },
    "engines": {
        "node": "18"
    }
}

You have @remix-run/serve listed as a devDependency, which means that by default it won’t be available when running in production.

I’d recommend moving that to the dependencies section of your package.json. Alternately you can remove or comment out the prune statement in your Dockerfile, but that will result in a larger image including a number of things you only need at bulid time.

Yea, that was a mistake on my part. I moved it but now I see a different error:

 2023-07-18T18:48:16.226 app[4d891247b44e48] yyz [info] > remix-serve build

2023-07-18T18:48:16.528 app[4d891247b44e48] yyz [info] Error: Cannot find module '/app/build'

2023-07-18T18:48:16.528 app[4d891247b44e48] yyz [info] Require stack:

2023-07-18T18:48:16.528 app[4d891247b44e48] yyz [info] - /app/node_modules/.pnpm/@remix-run+serve@1.18.1/node_modules/@remix-run/serve/dist/cli.j

I have it working now, thanks. I had some old config from the previous host

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.