refinedev/refine · warning

Refine will use `./build/server/index.js` as default

Error message

Refine will use `./build/server/index.js` as default

What it means

Emitted by the Refine CLI runner's remix-vite preset when `refine start` is called without an explicit entry file. The CLI warns that it is assuming the Vite build server output `./build/server/index.js` as the entry. If that file doesn't exist (e.g., not built yet), the subsequent start will fail with a module-not-found error.

Source

Thrown at packages/cli/src/commands/runner/projectScripts.ts:99

    },
  },
  [ProjectTypes.REMIX_VITE]: {
    getDev: (args: string[]) => ["vite:dev", ...args],
    getStart: (args: string[]) => {
      // remix-serve accepts a path to the entry file as an argument
      // if we have arguments, we will pass them to remix-serve and do nothing.
      // ex: `refine start ./build/server/index.js`
      const hasArgs = args?.length;
      if (hasArgs) {
        return args;
      }

      // otherwise print a warning and use `./build/server/index.js` as default
      console.log();
      console.warn(
        "🚨 Remix requires a path to the entry file. Please provide it as an argument to `refine start` command in package.json scripts",
      );
      console.warn("Refine will use `./build/server/index.js` as default");
      console.warn("Example: `refine start ./build/server/index.js`");
      console.log();

      return ["./build/server/index.js"];
    },
    getBuild: (args: string[]) => ["vite:build", ...args],
    getBin: (type?: "dev" | "start" | "build") => {
      return resolveBin(type === "start" ? "remix-serve" : "remix");
    },
  },
  [ProjectTypes.REMIX_SPA]: {
    getDev: (args: string[]) => ["vite:dev", ...args],
    getStart: (args: string[]) => ["preview", ...args],
    getBuild: (args: string[]) => ["vite:build", ...args],
    getBin: (type?: "dev" | "start" | "build") => {
      return resolveBin(type === "start" ? "vite" : "remix");
    },
  },

View on GitHub (pinned to 779d52a20e)

Solutions

  1. Add `./build/server/index.js` to the start script
  2. Ensure the build step (`vite:build`) runs before start in your workflow
  3. If the build output path is customized in vite.config, pass the real path explicitly

Example fix

// before
"start": "refine start"
// after
"start": "refine start ./build/server/index.js"
Defensive patterns

Strategy: validation

Validate before calling

if (!existsSync('./build/server/index.js')) throw new Error('Missing ./build/server/index.js — build first');

Prevention

When it happens

Trigger: `refine start` with zero extra args in a project detected as remix-vite (hasArgs false), so the runner returns the hardcoded default entry array.

Common situations: Running `refine start` before `refine build` in a Remix Vite project; templates that shipped `"start": "refine start"`; misreading classic Remix docs (./build/index.js) while on the Vite plugin.

Related errors


AI-assisted analysis of refinedev/refine@779d52a20e (2026-08-27). Data as JSON: /api/errors/66ab0ebeb3bca8ce. Report an issue: GitHub.