运行next.js应用程序映像时获得错误信息:
已就绪-已启动服务器,位于0.0.0.0:3000,url:网址:http://本地主机:3000
错误:未能在"/app/. next "目录中找到生产生成。请尝试使用" next build "生成应用,然后在NextNodeServer上启动生产服务器。https://nextjs.org/docs/messages/production-start-no-build-id。在NextServer上的新服务器(/app/node_modules/next/dist/server/next-server. js:93:29)上获取BuildId(/app/node_modules/next/dist/server/next-server. js:137:23)在NextServer上的新NextNodeServer(/app/node_modules/next/dist/server/next-server. js:86:9)上获取BuildId(/app/node_modules/next/dist/server/next-server. js:109:16)在异步/app/node_modules/next/dist/server/next.js:121:31 npm错误!代码ELIFECYCLE npm错误!错误号1 npm错误! anubis-next start
npm ERR!退出状态1 npm ERR! npm ERR! anubis-aio@0. 1. 0启动脚本失败。npm ERR!这可能不是npm的问题。上面可能有其他日志记录输出。npm ERR!此运行的完整日志位于:错误!/根目录/. npm/_日志/2022 - 05 - 11T12_32_58_222Z-调试日志
停靠文件:
FROM node:14-alpine AS deps
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
FROM node:14-alpine AS builder
WORKDIR /app
COPY --from=deps /app ./
RUN npm build
FROM node:14-alpine AS runner
WORKDIR /app
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
RUN npm install next
EXPOSE 3000
CMD ["npm","run","start"]
我需要在dockerignore中添加. next吗?这样做会在构建映像时出错
2条答案
按热度按时间yacmzcpb1#
以下命令解决了我的错误
piv4azn72#
此命令可解决您的问题
npm install