4

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: Expected an opening square bracket.

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)

5
  • Could you add the whole trace? Commented May 25, 2021 at 18:03
  • Hi Simon, that is the whole trace? Commented May 26, 2021 at 1:13
  • Unless there is some way to log more information? Commented May 26, 2021 at 1:16
  • I just started getting this error too. Did you ever figure it out? Commented Jun 9, 2021 at 2:41
  • To be honest i didn't go any further with iit. I went back to Gatsby. Commented Jun 11, 2021 at 6:17

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

1 Comment

ok valid point. If I run yarn next build i still get the same error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.