Devin
Devin
NNuxt
Created by Devin on 11/4/2024 in #❓・help
IPX_ERROR when using nuxt/image in dockerfile
Ive created this dockerfile to build my nuxt project like the following:
FROM oven/bun:latest as build

WORKDIR /app
COPY package.json bun.lockb tsconfig.json ./

RUN bun install --verbose

# Copy the rest of the application files
COPY . .

# Build the application for production
RUN bun run build

RUN rm -rf .output/server/node_modules
RUN bun install --cwd .output/server/

FROM node:lts-slim as runner

ENV NODE_ENV=PRODUCTION
EXPOSE 3000

WORKDIR /app

COPY --from=build /app/.output .output

ENTRYPOINT ["node", ".output/server/index.mjs"]
FROM oven/bun:latest as build

WORKDIR /app
COPY package.json bun.lockb tsconfig.json ./

RUN bun install --verbose

# Copy the rest of the application files
COPY . .

# Build the application for production
RUN bun run build

RUN rm -rf .output/server/node_modules
RUN bun install --cwd .output/server/

FROM node:lts-slim as runner

ENV NODE_ENV=PRODUCTION
EXPOSE 3000

WORKDIR /app

COPY --from=build /app/.output .output

ENTRYPOINT ["node", ".output/server/index.mjs"]
Without
RUN rm -rf .output/server/node_modules
RUN bun install --cwd .output/server/
RUN rm -rf .output/server/node_modules
RUN bun install --cwd .output/server/
The resulting image is "broken" because i get the IPX_ERROR from nuxt/image when loading my images. Does somebody have an idea, without this workaround?
6 replies
NNuxt
Created by Devin on 11/4/2024 in #❓・help
Error when deploying nuxt using bun and node 20.
Hello, i have a few errors deploying my nuxt app to an ubuntu server ive setup. The issue is when running the raw output file, i get the following error:
[nuxt] [request error] [unhandled] [500] Cannot find package '/home/vm/vzweb2/.output/server/node_modules/@unhead/shared/index.js' imported from /home/vm/vzweb2/.output/server/chunks/routes/renderer.mjs
at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
at packageResolve (node:internal/modules/esm/resolve:841:14)
at moduleResolve (node:internal/modules/esm/resolve:927:18)
at defaultResolve (node:internal/modules/esm/resolve:1169:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:542:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:510:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
at link (node:internal/modules/esm/module_job:95:36)
[nuxt] [request error] [unhandled] [500] Cannot find package '/home/vm/vzweb2/.output/server/node_modules/@unhead/shared/index.js' imported from /home/vm/vzweb2/.output/server/chunks/routes/renderer.mjs
at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
at packageResolve (node:internal/modules/esm/resolve:841:14)
at moduleResolve (node:internal/modules/esm/resolve:927:18)
at defaultResolve (node:internal/modules/esm/resolve:1169:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:542:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:510:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
at link (node:internal/modules/esm/module_job:95:36)
Ive got this kind of working by going into the /server folder and dthen deleting the node_modules and reinstalling them. The folder has run successfully on my macbook when running it from node, but it may have some other preinstalled stuff making it work.
7 replies