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

Remix serve missing module #7094

Open
1 task done
Ardear opened this issue Aug 7, 2023 · 3 comments
Open
1 task done

Remix serve missing module #7094

Ardear opened this issue Aug 7, 2023 · 3 comments
Labels
bug:unverified pm:pnpm Bugs related to pnpm

Comments

@Ardear
Copy link

Ardear commented Aug 7, 2023

What version of Remix are you using?

1.19.2

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

I'm trying to deploy remix with docker. Both the docker build and the local deployment succeeded, but it shows error when I run the container.

error as:

> remix-template-remix@ start /app
> remix-serve build

Error: Cannot find module 'form-data'
Require stack:
- /app/build/index.js
- /app/node_modules/.pnpm/@remix-run+serve@1.19.2/node_modules/@remix-run/serve/dist/cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Function.Module._load (node:internal/modules/cjs/loader:901:27)
	...

steps in local:

pnpm install --frozen-lockfile
pnpm build:remix
pnpm start

dockerfile as:

FROM node:20-slim AS base

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm rebuild esbuild
RUN pnpm build:remix

FROM base
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/build /app/build
COPY --from=build /app/public /app/public
EXPOSE 3000
CMD [ "pnpm", "start" ]

package.json as:

{
    "scripts": {
        "build:remix": "remix build",
        "dev:remix": "remix dev",
        "start": "remix-serve build",
   	},
	"dependencies": {
	    "@remix-run/node": "1.19.2",
	    "@remix-run/react": "1.19.2",
	    "@remix-run/serve": "1.19.2",
	    "react": "18.2.0",
	    "remix": "1.19.2",
	  },
	"devDependencies": {
	    "@remix-run/dev": "1.19.2",
	    "@remix-run/eslint-config": "1.19.2",
	  },
}

Expected Behavior

remix-serve build no error

Actual Behavior

Receive an error

@brophdawg11 brophdawg11 added the pm:pnpm Bugs related to pnpm label Aug 7, 2023
@justinwaite
Copy link
Contributor

justinwaite commented Aug 8, 2023

I'm receiving this error, but only when adding axios to serverDependenciesToBundle as suggested by the compiler.

If I remove axios from serverDependenciesToBundle then it seems to work fine, but with the compiler warning.

@Ardear
Copy link
Author

Ardear commented Aug 9, 2023

I'm receiving this error, but only when adding axios to serverDependenciesToBundle as suggested by the compiler.

If I remove axios from serverDependenciesToBundle then it seems to work fine, but with the compiler warning.

It works ! Thank you !

@Ardear Ardear closed this as completed Aug 9, 2023
@justinwaite
Copy link
Contributor

I’m curious if we should leave this open though. I don’t think this behavior existing previously, though I could be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:unverified pm:pnpm Bugs related to pnpm
Projects
None yet
Development

No branches or pull requests

3 participants