node.jsbuildviteremix.run

Vite build hangs after npm run build despite successful build message (Remix)


My docker build hung after it says it was successfully built. I've tried just about everything but my options are limited because it's rather difficult to find any errors. Here's the build log:

docker build --no-cache .
[+] Building 1287.9s (10/12)                          docker:desktop-linux
 => [internal] load build definition from Dockerfile                  0.0s
 => => transferring dockerfile: 512B                                  0.0s
 => [internal] load metadata for docker.io/library/node:18-alpine     0.8s
 => [auth] library/node:pull token for registry-1.docker.io           0.0s
 => [internal] load .dockerignore                                     0.0s
 => => transferring context: 66B                                      0.0s
 => [1/7] FROM docker.io/library/node:18-alpine@sha256:a25c1e4ecc284  0.0s
 => [internal] load build context                                     0.1s
 => => transferring context: 160.43kB                                 0.1s
 => CACHED [2/7] WORKDIR /app                                         0.0s
 => [3/7] COPY . .                                                    0.2s
 => [4/7] RUN npm install --omit=dev                                 16.1s
 => [5/7] RUN npm remove @shopify/app @shopify/cli                    1.4s 
 => [6/7] RUN npm run build                                        1269.3s 
 => => # kB │ gzip:  43.31 kB                                              
 => => # build/client/assets/context-BlhKCYcd.js                   154.68  
 => => # kB │ gzip:  17.73 kB                                              
 => => # build/client/assets/app.textEditor._blog._id-BM8eDdfO.js  314.49  
 => => # kB │ gzip: 106.13 kB                                             
 => => # ✓ built in 3.25s                                                 

I wish I had more logs to share but if there are more error signs, I have been unable to find them. I've tried updating docker, restarting the container, restarting my computer, reverting code base to time where I know it worked at one point, modifying docker file, running vite build (worked fine), all of this came after trying a ton of stuff with deploying it to heroku (doing the docker build on my machine was a way to try and replicate the issue). I've also tried just waiting it out, after an hour I figured it probably wouldn't magically suddenly work.

Any ideas on how to find the problem or why this could possibly happen would be greatly appreciated! I'm not entirely sure what other parts of my code would be relevant for this, here's my Dockerfile:

FROM node:18-alpine

WORKDIR /app
COPY . .

# Install dependencies with more verbose output
RUN npm install --omit=dev --verbose

# Remove Shopify CLI (as you're doing)
RUN npm remove @shopify/app @shopify/cli --verbose

# Build step
RUN npm run build

# Add debugging steps
RUN echo "Listing build output directory:"
RUN ls -la build/

# Generate Prisma client separately from start script
RUN npx prisma generate

# Start command with more visibility
CMD ["sh", "-c", "echo 'Starting app...' && npm run start"]

I've tried doing all kinds of error logging but it always just stops on #11 4.355 ✓ built in 3.60s or however many seconds.

Any ideas would be greatly appreciated!!

(In case anyone asks, here's my package.json)

{
  "name": "devsandbox2",
  "private": true,
  "scripts": {
    "build": "vite build && vite build --ssr",
    "dev": "shopify app dev",
    "config:link": "shopify app config link",
    "generate": "shopify app generate",
    "deploy": "shopify app deploy",
    "config:use": "shopify app config use",
    "env": "shopify app env",
    "start": "remix-serve ./build/server/index.js",
    "docker-start": "npm run start",
    "docker-setup": "prisma generate && prisma migrate deploy",
    "setup": "prisma generate && prisma migrate deploy",
    "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
    "shopify": "shopify",
    "prisma": "prisma",
    "graphql-codegen": "graphql-codegen",
    "vite": "vite"
  },
  "type": "module",
  "dependencies": {
    "@prisma/client": "^5.11.0",
    "@remix-run/dev": "^2.7.1",
    "@remix-run/node": "^2.7.1",
    "@remix-run/react": "^2.7.1",
    "@remix-run/serve": "^2.7.1",
    "@shopify/app-bridge-react": "^4.1.3",
    "@shopify/polaris": "^12.27.0",
    "@shopify/shopify-api": "^10.0.0",
    "@shopify/shopify-app-remix": "^2.8.2",
    "@shopify/shopify-app-session-storage-prisma": "^4.0.5",
    "@tinymce/tinymce-react": "^5.1.1",
    "@types/he": "^1.2.3",
    "form-data": "^4.0.0",
    "he": "^1.2.0",
    "image-extensions": "^1.1.0",
    "is-url": "^1.2.4",
    "isbot": "^5.1.0",
    "lodash.debounce": "^4.0.8",
    "nanoid": "^5.0.7",
    "next": "^14.2.5",
    "prisma": "^5.11.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "slate": "^0.103.0",
    "slate-history": "^0.109.0",
    "slate-hyperscript": "^0.100.0",
    "slate-react": "^0.107.1",
    "styled-components": "^6.1.12",
    "vite-tsconfig-paths": "^4.3.1"
  },
  "devDependencies": {
    "@remix-run/eslint-config": "^2.7.1",
    "@shopify/api-codegen-preset": "^0.0.7",
    "@shopify/app-bridge-types": "^0.0.11",
    "@types/eslint": "^8.40.0",
    "@types/is-url": "^1.2.32",
    "@types/node": "^20.6.3",
    "@types/react": "^18.2.31",
    "@types/react-dom": "^18.2.14",
    "eslint": "^8.42.0",
    "eslint-config-prettier": "^9.1.0",
    "prettier": "^3.2.4",
    "typescript": "^5.2.2",
    "vite": "^5.1.3"
  },
  "workspaces": [
    "extensions/*"
  ],
  "trustedDependencies": [
    "@shopify/plugin-cloudflare"
  ],
  "resolutions": {
    "undici": "6.13.0"
  },
  "overrides": {
    "undici": "6.13.0"
  },
  "author": "beckett"
}

Solution

  • For anyone wondering, the issue was with my package.json file, I was running my build as vite build but the correct version was remix vite:build.

    So change:

    "build": "vite build && vite build --ssr"
    

    To:

    "build": "remix vite:build",
    

    There isn't really an error that shows up to display this, it just never completes after displaying ✓ built in 3.25s.