Repository: next.js
Issue: Next.js project doesn't work with Yarn 4.6.0 using Turbopack
Labels: create-next-app,Turbopack

### Link to the code that reproduces this issue

https://github.com/GlittersIsGold/turboyarnext

### To Reproduce

1. install yarn 4.6.0 - ```npm install -g yarn@latest```

2. check yarn version - ```yarn -v``` should output 4.6.0

3. init next-app with yarn - ```yarn create next-app turboyarnext```

4. Follow the prompts, simply answer Yes to use Turbopack

```
✔ Would you like to use TypeScript? … No / Yes - Y
✔ Would you like to use ESLint? … No / Yes - Y
✔ Would you like to use Tailwind CSS? … No / Yes - N
✔ Would you like your code inside a `src/` directory? … No / Yes - N
✔ Would you like to use App Router? (recommended) … No / Yes - Y
✔ Would you like to use Turbopack for `next dev`? … No / Yes - Y
? Would you like to customize the import alias (`@/*` by default)? › No / Yes - N
```
```
Creating a new Next.js app in /Users/GlittersIsGold/Documents/Programms/turboyarnext.

Using yarn.

Initializing project with template: app 

Installing dependencies:
- react
- react-dom
- next

Installing devDependencies:
- typescript
- @types/node
- @types/react
- @types/react-dom
- eslint
- eslint-config-next
- @eslint/eslintrc

! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e.
! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager

➤ YN0000: · Yarn 4.6.0
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + @eslint/eslintrc@npm:3.2.0, @types/node@npm:20.17.12, @types/react-dom@npm:19.0.2, and 319 more.
➤ YN0000: └ Completed in 3s 599ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ sharp@npm:0.33.5 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 1s 361ms
➤ YN0000: · Done with warnings in 5s 185ms
Initialized a git repository.

Success! Created turboyarnext at /Users/GlittersIsGold/Documents/Programm/turboyarnext
```

5. proceed to project dir, install deps and try to start app

```cd turboyarnext && yarn && yarn dev```

```
➜  turboyarnext git:(main) yarn
➤ YN0000: · Yarn 4.6.0
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: · Done with warnings in 0s 272ms

➜  turboyarnext git:(main) yarn dev
   ▲ Next.js 15.1.4 (Turbopack)
   - Local:        http://localhost:3000
   - Network:      http://79.164.27.29:3000

 ✓ Starting...
FATAL: An unexpected Turbopack error occurred. Please report the content of /var/folders/st/_ln0wwtj7xl3pd3l2sv8xh700000gn/T/next-panic-fc976d666c1f252cd743c4aa6d34fee8.log, along with a description of what you were doing when the error occurred, to https://github.com/vercel/next.js/issues/new
[Error [TurbopackInternalError]: Next.js package not found

Debug info:
- Execution of get_entrypoints_with_issues failed
- Execution of Project::entrypoints failed
- Execution of AppProject::routes failed
- Execution of directory_tree_to_entrypoints_internal failed
- Execution of directory_tree_to_loader_tree failed
- Execution of *FileSystemPath::join failed
- Execution of get_next_package failed
- Next.js package not found]
```

6. Get an error

```
cat /var/folders/st/_ln0wwtj7xl3pd3l2sv8xh700000gn/T/next-panic-fc976d666c1f252cd743c4aa6d34fee8.log
---------------------------
Next.js package not found

Debug info:
- Execution of get_entrypoints_with_issues failed
- Execution of Project::entrypoints failed
- Execution of AppProject::routes failed
- Execution of directory_tree_to_entrypoints_internal failed
- Execution of directory_tree_to_loader_tree failed
- Execution of *FileSystemPath::join failed
- Execution of get_next_package failed
- Next.js package not found
```

### Current vs. Expected behavior

Expected to launch Next app via Turbopack & yarn dev, observed to Fatal Turbopack error, package not found.

Next package already exists in package.json

```package.json
{
  "name": "turboyarnext",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "15.1.4",
    "react": "^19.0.0",
    "react-dom": "^19.0.0"
  },
  "devDependencies": {
    "@eslint/eslintrc": "^3",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "eslint": "^9",
    "eslint-config-next": "15.1.4",
    "typescript": "^5"
  },
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
```

### Provide environment information

```bash
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 19:02:41 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 12
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: 4.6.0
  pnpm: N/A
Relevant Packages:
  next: 15.1.4
  eslint-config-next: 15.1.4
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
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

_No response_