Cannot find module ‘@next/bundle-analyzer‘

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'

// });

相关推荐
C^h8 小时前
c++ string
开发语言·c++
raindayinrain8 小时前
c++高性能--原子操作,无锁编程,操作顺序
开发语言·c++·性能优化
学逆向的9 小时前
C++ 合并命名空间
开发语言·c++·网络安全
Zhao-Jichao9 小时前
VS2026 打包 C++ 程序生成 EXE,借助 Installer Project 扩展工具
开发语言·c++
她说可以呀9 小时前
Vue插槽
前端·javascript·vue.js
qq_448011169 小时前
Vue + Jinja2两套模版与法冲突造成undefinedError
前端·javascript·vue.js
学逆向的10 小时前
C 局部静态变量
c语言·开发语言·网络安全
大都督会赢的10 小时前
C++第一节课
开发语言·c++
“AI国潮设计-小江”10 小时前
【AIGC实战】Python+Stable Diffusion打造“英歌舞财神”IP,解锁“马到成功”等爆款情绪营销文案设计
开发语言·人工智能·python·prompt·aigc
小王C语言10 小时前
Qt常用控件:容器类控件,标题分组框、标签页(浏览器标签)
开发语言·qt