28.85 npm notice
28.99
28.99 > nextjs-15-starter-shadcn@1.0.0 build
28.99 > next build
28.99
29.49 ⨯ Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
29.50
29.50 > Build error occurred
29.50 [Error: Cannot find module '@next/bundle-analyzer'
29.50 Require stack:
29.50 - /app/next.config.js] {
29.50 code: 'MODULE_NOT_FOUND',
29.50 requireStack: [Array]
29.50 }
Dockerfile:37
36 | # ENV NEXT_TELEMETRY_DISABLED=1
37 | >>> RUN \
38 | >>> if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
39 | >>> elif [ -f package-lock.json ]; then npm ci --legacy-peer-deps; \
40 | >>> elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
41 | >>> else echo "Lockfile not found." && exit 1; \
42 | >>> fi && \
43 | >>> if [ -f yarn.lock ]; then yarn run build; \
44 | >>> elif [ -f package-lock.json ]; then npm run build; \
45 | >>> elif [ -f pnpm-lock.yaml ]; then pnpm run build; \
46 | >>> else echo "Build command not found." && exit 1; \
47 | >>> fi
48 | # RUN \
ERROR: failed to build: failed to solve: process "/bin/sh -c if [ -f yarn.lock ]; then yarn --frozen-lockfile; elif [ -f package-lock.json ]; then npm ci --legacy-peer-deps; elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; else echo \"Lockfile not found.\" && exit 1; fi && if [ -f yarn.lock ]; then yarn run build; elif [ -f package-lock.json ]; then npm run build; elif [ -f pnpm-lock.yaml ]; then pnpm run build; else echo \"Build command not found.\" && exit 1; fi" did not complete successfully: exit code: 1
删掉或者注解以下内容next.config.js
// module.exports = withBundleAnalyzer(nextConfig);
// const initializeBundleAnalyzer = require('@next/bundle-analyzer');
// // https://www.npmjs.com/package/@next/bundle-analyzer
// const withBundleAnalyzer = initializeBundleAnalyzer({
// enabled: process.env.BUNDLE_ANALYZER_ENABLED === 'true'
// });