Nextjs 构建错误,详细日志记录不显示任何内容 [英] Nextjs build errors, verbose logging shows nothing

查看:53
本文介绍了Nextjs 构建错误,详细日志记录不显示任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是最新版本的 Nextjs.在开发人员模式下测试和运行时,项目运行良好.当我尝试生产构建 npx next build --debug 时,我收到以下错误.输出并没有告诉我问题是什么.任何想法如何从此错误中获取详细信息?

I'm using the latest version Nextjs. The project is running fine when testing and running in developer mode. When I try a production build npx next build --debug I get the error below. The output doesn't tell me much about what the problem is. Any ideas how to get the verbose information from this error?

HookWebpackError:需要一个左方括号.

HookWebpackError: Expected an opening square bracket.

发生构建错误错误:>由于 webpack 错误,构建失败在/Users/xxx/projects/nextjs/my-next-website/node_modules/next/dist/build/index.js:17:924在 async Span.traceAsyncFn (/Users/xxx/projects/nextjs/my-next-website/node_modules/next/dist/telemetry/trace/trace.js:6:584)

Build error occurred Error: > Build failed because of webpack errors at /Users/xxx/projects/nextjs/my-next-website/node_modules/next/dist/build/index.js:17:924 at async Span.traceAsyncFn (/Users/xxx/projects/nextjs/my-next-website/node_modules/next/dist/telemetry/trace/trace.js:6:584)

推荐答案

npx 可能会加载与本地依赖项不同的 next 版本.我不建议使用 npx 运行它.而是创建一个 npm 脚本,或者使用 npm bin next,或者如果你使用 yarn,你可以使用带有 yarn next 的本地二进制文件.

npx might load a different version of next than your local dependency. I wouldn't recommend running this with npx. Instead make an npm script, or use npm bin next, or if you use yarn you can use local binaries with yarn next.

这篇关于Nextjs 构建错误,详细日志记录不显示任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆