Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

579
Views
Vinculación de PNPM con la compilación independiente de NextJS

Estoy tratando de crear un Dockerfile de producción usando el modo independiente NextJS y PNPM.

En next.config.js tengo configuración de salida:

 experimental: { outputStandalone: true, outputFileTracingRoot: path.join(__dirname, '../../'), },

Y en Dockerfile estoy usando una compilación de varias etapas:

 # BUILD STEP FROM node:16.13-alpine as landing-builder WORKDIR /dml-sdk COPY ./pnpm-workspace.yaml . COPY ./pnpm-lock.yaml . COPY ./tsconfig.base.json . COPY ./package.json . COPY ./apps/landing ./apps/landing RUN apk --no-cache add curl RUN apk --no-cache add git RUN curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6 RUN pnpm config set store-dir .pnpm-store RUN pnpm i RUN pnpm build # RUNNER STEP FROM node:16.13-alpine as landing-runner WORKDIR /dml-sdk ENV NODE_ENV production RUN addgroup -g 1001 -S nodejs RUN adduser -S nextjs -u 1001 COPY --from=landing-builder /dml-sdk/apps/landing/public ./public COPY --from=landing-builder --chown=nextjs:nodejs /dml-sdk/apps/landing/.next/standalone ./ COPY --from=landing-builder --chown=nextjs:nodejs /dml-sdk/node_modules ./node_modules ENV NEXT_TELEMETRY_DISABLED 1 ENV PORT 3010 EXPOSE 3010 WORKDIR /dml-sdk/apps/landing CMD ["node", "server.js"]

Por alguna razón, me encuentro con un error:

 landing | Error: Cannot find module 'next/dist/server/next-server' landing | Require stack: landing | - /powerplay-sdk/apps/landing/server.js

Parece que el siguiente servidor no está incluido en el directorio standalone y la línea:

 const NextServer = require('next/dist/server/next-server').default

está vinculado a raíz node_modules, en lugar de /dml-sdk/standalone/apps/landing/node_modules :

 node_modules/.pnpm/next@12.0.8_react-dom@17.0.2+react@17.0.2/node_modules/next/dist/server/next-server.d.ts

¿Es posible deshabilitar el enlace del siguiente servidor en el paso CONSTRUIR, de modo que los nodos_módulos standalone incluyan next-server ?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!