Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to patch lock while when a dependency is depending on a different version of Next.js #65182

Closed
mwskwong opened this issue Apr 30, 2024 · 10 comments
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application. locked

Comments

@mwskwong
Copy link

mwskwong commented Apr 30, 2024

Link to the code that reproduces this issue

https://github.com/mwskwong/next-patch-lockfile-fail

To Reproduce

Run next dev or next build and observe the terminal output.

Current vs. Expected behavior

Current

Dependencies are as follow:

Next.js is trying to patch the lock file for the Next.js v14.1.0. It failed to do so, and threw the following error:

 ⚠ Found lockfile missing swc dependencies, patching...
 ⨯ Failed to patch lockfile, please try uninstalling and reinstalling next in this workspace
TypeError: Cannot read properties of undefined (reading 'os')
    at fetchPkgInfo (/node_modules/next/dist/lib/patch-incorrect-lockfile.js:73:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async patchIncorrectLockfile (/node_modules/next/dist/lib/patch-incorrect-lockfile.js:162:26)

Expected

Such error should not be thrown

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: 1.22.19
  pnpm: 8.15.4
Relevant Packages:
  next: 14.3.0-canary.31 // Latest available version is detected (14.3.0-canary.31).
  eslint-config-next: 14.3.0-canary.31
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: N/A

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

create-next-app

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

next dev (local), next build (local)

Additional context

So far, this doesn't seem to impact the main application, including next dev and next build.

There isn't seem to have any issues on starting the React Email dev server, which is based on Next.js either.

@mwskwong mwskwong added the bug Issue was opened via the bug report template. label Apr 30, 2024
@github-actions github-actions bot added the create-next-app Related to our CLI tool for quickly starting a new Next.js application. label Apr 30, 2024
@GabrielCev
Copy link

GabrielCev commented May 28, 2024

I have the same issue, after update i have this line in my webpack-config.js:

if (parseInt(_react.default.version) < 19) {
    throw new Error('Next.js requires react >= 19.0.0 to be installed.');
}

react 19.0.0 is not released yet and in Beta.
commenting this out will result in the same error as above

@joshwcomeau
Copy link

Running into the same issue after updating to React 19 / Next 15. When starting a dev server, I see:

  ▲ Next.js 15.0.0-rc.0
  - Local:        http://localhost:8020
  - Environments: .env.local
  - Experiments (use with caution):
    · scrollRestoration

 ✓ Starting...
 ⚠ Found lockfile missing swc dependencies, patching...
 ⨯ Failed to patch lockfile, please try uninstalling and reinstalling next in this workspace
TypeError: Cannot read properties of undefined (reading 'os')
    at fetchPkgInfo (/Users/joshu/work/blog-v3/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]_kxxc2t6qs3v2xlyoy2gzfdrn64/node_modules/next/dist/lib/patch-incorrect-lockfile.js:73:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async patchIncorrectLockfile (/Users/joshu/work/blog-v3/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]_kxxc2t6qs3v2xlyoy2gzfdrn64/node_modules/next/dist/lib/patch-incorrect-lockfile.js:162:26)
 ✓ Ready in 3s

Uninstalling and reinstalling Next had no effect. Fortunately, however, things still seem to work. Here's the rest of the debug info:

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
  Available memory (MB): 65536
  Available CPU cores: 10
Binaries:
  Node: 20.11.1
  npm: 10.2.4
  Yarn: N/A
  pnpm: 9.1.4
Relevant Packages:
  next: 15.0.0-rc.0 // Latest available version is detected (15.0.0-rc.0).
  eslint-config-next: 14.1.0
  react: 19.0.0-rc-f994737d14-20240522
  react-dom: 19.0.0-rc-f994737d14-20240522
  typescript: 5.4.5
Next.js Config:
  output: N/A

@SukkaW
Copy link
Contributor

SukkaW commented Jun 4, 2024

@joshwcomeau This will be fixed by #66515

@sdbeng
Copy link

sdbeng commented Jul 24, 2024

Just checking the dashboard repo, while running pnpm -dev, it compiles fine but got the same locfile missing warning now with the rc.56
TypeError: Cannot read properties of undefined (reading 'os')
at fetchPkgInfo (/Users/su/dashboard-next/nextjs-dashboard/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/lib/patch-incorrect-lockfile.js:73:25)

node: v20.16.0
OS: sonoma 14.5
pnpm: v9.6.0

@ikushlianski
Copy link

Works for me now as of August 12, 2024 after updating the following dependencies:

    "next": "15.0.0-canary.111",
    "react": "19.0.0-rc-187dd6a7-20240806",
    "react-dom": "19.0.0-rc-187dd6a7-20240806"

Mind the React and React DOM versions. They need to be updated as you update next

@GabrielCev
Copy link

thanks @ikushlianski these versions fixed the issue for me

@rubben-ruiz
Copy link

@ikushlianski great!

@SukkaW
Copy link
Contributor

SukkaW commented Aug 20, 2024

@ijjk We might wanna close the issue now since it appears that my PR #66515 did resolve the issue.

@ztanner ztanner closed this as completed Aug 20, 2024
@brokenhoax
Copy link

vercel might want to update their getting-started courseware as I ran in to this issue when working through the tutorial. This will scare noobs. 😆 Next.js tutorial link here

Copy link
Contributor

github-actions bot commented Sep 8, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Sep 8, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application. locked
Projects
None yet
Development

No branches or pull requests

9 participants