Skip to content

NextJS 14.0.4 build error with react-hook-form #59470

Closed as not planned
Closed as not planned
@elanpang

Description

@elanpang

Link to the code that reproduces this issue

https://github.com/elanpang/nxjs-14-rhf-7-issue-1.git

To Reproduce

just run npm run build

Current vs. Expected behavior

Current :

got the build error below:

Generating static pages (0/7) [= ]TypeError: Cannot read properties of null (reading 'control')
at useController

Expected:

build pass

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.1.0: Mon Oct  9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000
Binaries:
  Node: 18.18.2
  npm: 9.8.1
  Yarn: 1.22.21
  pnpm: 8.10.0
Relevant Packages:
  next: 14.0.4
  eslint-config-next: 14.0.4
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Additional context

Runnpm run dev works well.

I had tried 14.0.5-canary.5, got the same build error.

I'm not sure the root cause, also opened a ticket for react-hook-form, pls ref below:

react-hook-form/react-hook-form#11279

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.lockedstaleThe issue has not seen recent activity.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions