nextjs - ✅(Solved) Fix Can't PNPM Install using pnpm version 10 < x < 10.5.0 [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#91954Fetched 2026-04-08 01:35:32
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
1
Participants
Timeline (top)
commented ×2cross-referenced ×1issue_type_added ×1labeled ×1

Error Message

Current: pnpm i produces this error: ERROR  packages field missing or empty

Root Cause

This project is configured to use pnpm because /Users/alfonsusac/package.json has a "packageManager" field
This project is configured to use pnpm because /Users/alfonsusac/package.json has a "packageManager" field

Fix Action

Fixed

PR fix notes

PR #91956: fix(create-next-app): add pnpm 10.0–10.4 workspace.yaml compatibility

Description (problem / solution / changelog)

<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # -->

Fixes #91954

Problem occurs when trying to create pnpm add on a freshly installed next.js app using pnpm create next-app@latest . using a semi-outdated pnpm, specifically version between 10.0 and 10.4.5.

The package field was required in the generated pnpm-workspace.yaml up until version 10.4.5 where they had removed the requirement afterwards.

A check on pnpm minor version <10.5 was added to include package: [] on generated pnpm-workspace.yaml.

Changed files

  • packages/create-next-app/helpers/get-pkg-manager.ts (modified, +12/-5)
  • packages/create-next-app/templates/index.ts (modified, +10/-4)

Code Example

ERROR  packages field missing or empty

---

This project is configured to use pnpm because /Users/alfonsusac/package.json has a "packageManager" field
This project is configured to use pnpm because /Users/alfonsusac/package.json has a "packageManager" field

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14
Binaries:
  Node: 20.19.5
  npm: 10.8.2
  Yarn: N/A
  pnpm: 10.33.0
Relevant Packages:
  next: 16.2.1 // Latest available version is detected (16.2.1).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template

To Reproduce

  1. Install pnpm version 10.4.1 using pnpm self-update 10.4
  2. Create project pnpm create next-app@latest .
  3. Try to install manually pnpm i

Current vs. Expected behavior

Expected: pnpm i works nicely Current: pnpm i produces this error:

 ERROR  packages field missing or empty
<img width="444" height="299" alt="Image" src="https://github.com/user-attachments/assets/9b6b1809-fb01-499a-938b-215531dde986" />

Provide environment information

This project is configured to use pnpm because /Users/alfonsusac/package.json has a "packageManager" field
This project is configured to use pnpm because /Users/alfonsusac/package.json has a "packageManager" field

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14
Binaries:
  Node: 20.19.5
  npm: 10.8.2
  Yarn: N/A
  pnpm: 10.33.0
Relevant Packages:
  next: 16.2.1 // Latest available version is detected (16.2.1).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
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)

Additional context

I expected the packages prop in pnpm-workspace.yaml to be omitted only when pnpm version is after 10.4.1 but after checking source code, it is being ommiteed for all version after 10.

Relevant Part of code

Relevant issue/pr

extent analysis

Fix Plan

To fix the issue, you need to update the pnpm-workspace.yaml file to include the packages field.

Here are the steps:

  • Open the pnpm-workspace.yaml file in your project directory.
  • Add the following lines to the file:
packages:
  - 'packages/*'
  • Save the changes.
  • Run pnpm i again to install the dependencies.

Alternatively, you can also update the index.ts file in the create-next-app package to handle the packages field correctly for pnpm versions after 10.4.1.

Here's an example of how you can do this:

// packages/create-next-app/templates/index.ts
// ...

const pnpmVersion = require('pnpm').version;
const isPnpmVersionAfter10_4_1 = pnpmVersion >= '10.4.1';

// ...

if (isPnpmVersionAfter10_4_1) {
  // Add the packages field to the pnpm-workspace.yaml file
  workspaceFile.contents = `
    packages:
      - 'packages/*'
  `;
} else {
  // Omit the packages field for pnpm versions before 10.4.1
  workspaceFile.contents = '';
}

Verification

To verify that the fix worked, run pnpm i again and check that the dependencies are installed correctly. You should no longer see the packages field missing or empty error.

Extra Tips

Make sure to update the pnpm version to the latest version to avoid any compatibility issues. You can do this by running pnpm self-update. Also, ensure that the packageManager field in your package.json file is set to pnpm to use the correct package manager.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING