question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

12.3.x causes `Collecting page data` to fail during build

See original GitHub issue

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 21.6.0: Mon Aug 22 20:20:05 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8101
Binaries:
  Node: 18.8.0
  npm: 8.18.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant packages:
  next: 12.3.1
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

After upgrading from 12.2.5 to 12.3.0 or 12.3.1 I started getting build errors during “Collecting page data” step. Error output includes

Generating static pages (0/3)TypeError: Cannot read properties of null (reading 'useContext') at exports.useContext
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useContext')

Expected Behavior

Should build without issues

Link to reproduction

https://github.com/WalletConnect/web3modal

To Reproduce

  1. Pull repository linked above
  2. Inside examples/react/package.json change next.js version to 12.3.1
  3. From root of the repo run npm install; npm run build

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
balazsorban44commented, Sep 26, 2022

I could confirm an issue when using npm workspaces. Likely introduced by https://github.com/vercel/next.js/pull/39520 since the first release containing the problem is v12.2.6-canary.0.

Switching to pnpm works, so it’s something to do with how npm workspaces handle the dependencies.

0reactions
0xAsimetriqcommented, Sep 26, 2022

Just tried again, essentially

  1. Removed package lockfile from root
  2. Deleted all node_modules in the project
  3. Updated nextjs version to 12.3.1
  4. Ran npm install (root)
  5. Ran npm run build (root)

Still failing, I noticed that after install total number of packages is 178, however with next 12.2.x it is 177

Read more comments on GitHub >

github_iconTop Results From Across the Web

next.js - NextJS collecting page data fails with status code 500
Failed at the my-app@0.1.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above....
Read more >
12.3 - Simple Linear Regression | STAT 200
In this lesson we will be learning specifically about simple linear regression. The "simple" part is that we will be using only one...
Read more >
Chapter 12. Encrypting block devices using LUKS
This procedure encrypts existing data on a block device without creating free space for storing a LUKS header. The header is stored in...
Read more >
12 Tidy data - R for Data Science - Hadley Wickham
Following three rules makes a dataset tidy: variables are in columns, ... There's a general advantage to picking one consistent way of storing...
Read more >
New Residential Construction, November 2022
Privately-owned housing units authorized by building permits in ... standard errors of the most recent data are shown in the tables.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found