next.js: [Error [TurbopackInternalError]: Next.js package not found

Link to the code that reproduces this issue

https://github.com/Chukwu3meka/waverd-client/tree/Chukwu3meka

To Reproduce

After upgrading to canary and migrating from tailwind3 to v4. Next runs fine but after sometime it crashes without making any change to the codebase.

Next version is next": "15.2.0-canary.56 but next info return:

next: 15.1.2 // There is a newer version (15.1.7) available, upgrade recommended!

Error I get is


FATAL: An unexpected Turbopack error occurred. Please report the content of C:\Users\CHUKWU~1\AppData\Local\Temp\next-panic-9a86b6afcb30f9175043498a85323cb4.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_operation failed
- Execution of EntrypointsOperation::new 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 get_next_package failed
- Next.js package not found]

The batch file cannot be found.

Image

Current vs. Expected behavior

This is my package.json and I use pnpm as my package manager.


{
  "name": "waverd-client",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@next/bundle-analyzer": "^15.1.7",
    "@radix-ui/react-dialog": "^1.1.6",
    "@radix-ui/react-navigation-menu": "^1.2.5",
    "@radix-ui/react-separator": "^1.1.2",
    "@radix-ui/react-slot": "^1.1.2",
    "@radix-ui/react-tabs": "^1.1.3",
    "@reduxjs/toolkit": "^2.5.1",
    "@vercel/analytics": "^1.5.0",
    "@vercel/speed-insights": "^1.2.0",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "lucide-react": "^0.475.0",
    "next": "15.2.0-canary.56",
    "next-themes": "^0.4.4",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "react-icons": "^5.4.0",
    "react-redux": "^9.2.0",
    "tailwind-merge": "^3.0.1",
    "tailwindcss-animate": "^1.0.7",
    "vaul": "^1.1.2"
  },
  "devDependencies": {
    "@playwright/test": "^1.50.1",
    "@tailwindcss/postcss": "^4",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "sass": "^1.84.0",
    "tailwindcss": "^4",
    "typescript": "^5"
  }
}


Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 16142
  Available CPU cores: 12
Binaries:
  Node: 22.12.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.15.2
Relevant Packages:
  next: 15.1.2 // There is a newer version (15.1.7) available, upgrade recommended!
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: N/A
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.1.7) available, upgrade recommended! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

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

Turbopack, Runtime, create-next-app, Script (next/script)

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

next dev (local)

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

For anyone coming through later, this can also be caused by having an unnecessary additional lock file in the package directory, rather than at the monorepo root.

Just noticed this same issue on my main app (not canary) after updating to "next": "15.2.1" from "next": "15.2.0" when I try to import a file that does not exist

Image

Running into this as well on next 15.1.7 when I recently switched to bun v1.2 in my monorepo, with the biggest difference being that I am now using Bun’s text based lockfile instead of binary. Ever since that change, nextjs no longer runs for me.

Here’s the contents of the panic 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_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

Running npm why, i see the nextjs package is present with the following dependency graph:

npm why output

next@15.1.7
node_modules/next
  peer next@">=15.0.0" from cookies-next@5.1.0
  node_modules/cookies-next
    cookies-next@"^5.0.2" from web@1.0.0
    apps/web
      web@1.0.0
      node_modules/web
        workspace apps/web from the root project
  peerOptional next@">=12.0.0" from inngest@3.31.7
  node_modules/inngest
    inngest@"^3.22.7" from @repo/jobs@0.1.0
    packages/jobs
      @repo/jobs@0.1.0
      node_modules/@repo/jobs
        workspace packages/jobs from the root project
  peer next@">= 14.0.0" from next-safe-action@7.10.3
  node_modules/next-safe-action
    next-safe-action@"^7.9.3" from web@1.0.0
    apps/web
      web@1.0.0
      node_modules/web
        workspace apps/web from the root project
  peer next@"*" from next-themes@1.0.0-beta.0
  node_modules/next-themes
    next-themes@"1.0.0-beta.0" from web@1.0.0
    apps/web
      web@1.0.0
      node_modules/web
        workspace apps/web from the root project
  peerOptional next@">=14.2.0" from nuqs@2.3.2
  node_modules/nuqs
    nuqs@"^2.2.3" from web@1.0.0
    apps/web
      web@1.0.0
      node_modules/web
        workspace apps/web from the root project
  peer next@"^13.0.0 || ^14.0.0 || ^15.0.0" from @inlang/paraglide-next@0.7.9
  node_modules/@inlang/paraglide-next
    @inlang/paraglide-next@"^0.7.2" from web@1.0.0
    apps/web
      web@1.0.0
      node_modules/web
        workspace apps/web from the root project
  peer next@"^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0" from @openpanel/nextjs@1.0.7
  node_modules/@openpanel/nextjs
    @openpanel/nextjs@"^1.0.0" from @repo/analytics@1.0.0
    packages/analytics
      @repo/analytics@1.0.0
      node_modules/@repo/analytics
        @repo/analytics@"*" from web@1.0.0
        apps/web
          web@1.0.0
          node_modules/web
            workspace apps/web from the root project
        workspace packages/analytics from the root project
  peer next@"^13.2.0 || ^14.0 || ^15.0.0-rc.0" from @sentry/nextjs@8.55.0
  node_modules/@sentry/nextjs
    @sentry/nextjs@"^8.54.0" from web@1.0.0
    apps/web
      web@1.0.0
      node_modules/web
        workspace apps/web from the root project
  peerOptional next@"*" from @vercel/flags@2.6.3
  node_modules/@vercel/flags
    @vercel/flags@"^2.6.3" from @repo/kv@1.0.0
    packages/kv
      @repo/kv@1.0.0
      node_modules/@repo/kv
        @repo/kv@"*" from elysiajs@1.0.50
        apps/elysia
          elysiajs@1.0.50
          node_modules/elysiajs
            workspace apps/elysia from the root project
        @repo/kv@"*" from web@1.0.0
        apps/web
          web@1.0.0
          node_modules/web
            workspace apps/web from the root project
        @repo/kv@"*" from @repo/jobs@0.1.0
        packages/jobs
          @repo/jobs@0.1.0
          node_modules/@repo/jobs
            workspace packages/jobs from the root project
        @repo/kv@"*" from @repo/services@0.1.0
        packages/services
          @repo/services@0.1.0
          node_modules/@repo/services
            @repo/services@"*" from web@1.0.0
            apps/web
              web@1.0.0
              node_modules/web
                workspace apps/web from the root project
            @repo/services@"*" from @repo/jobs@0.1.0
            packages/jobs
              @repo/jobs@0.1.0
              node_modules/@repo/jobs
                workspace packages/jobs from the root project
            workspace packages/services from the root project
        workspace packages/kv from the root project
  peerOptional next@">= 13" from @vercel/analytics@1.5.0
  node_modules/@vercel/analytics
    @vercel/analytics@"^1.3.2" from @repo/analytics@1.0.0
    packages/analytics
      @repo/analytics@1.0.0
      node_modules/@repo/analytics
        @repo/analytics@"*" from web@1.0.0
        apps/web
          web@1.0.0
          node_modules/web
            workspace apps/web from the root project
        workspace packages/analytics from the root project
  next@"15.1.7" from web@1.0.0
  apps/web
    web@1.0.0
    node_modules/web
      workspace apps/web from the root project

next@15.1.2 dev
node_modules/react-email/node_modules/next
  next@"15.1.2" from react-email@3.0.7
  node_modules/react-email
    dev react-email@"^3.0.7" from @repo/email@0.1.0
    packages/email
      @repo/email@0.1.0
      node_modules/@repo/email
        workspace packages/email from the root project

EDIT:

15.2.0-canary.57 seems to fix this. But then it breaks my build on Vercel:

web:build: Error: No "exports" main defined in /vercel/path0/node_modules/estree-walker/package.json
web:build: at exportsNotFound (node:internal/modules/esm/resolve:314:10)
web:build: at packageExportsResolve (node:internal/modules/esm/resolve:605:13)
web:build: at resolveExports (node:internal/modules/cjs/loader:638:36)
web:build: at Function._findPath (node:internal/modules/cjs/loader:743:31)
web:build: at Function.<anonymous> (node:internal/modules/cjs/loader:1230:27)
web:build: at /vercel/path0/node_modules/next/dist/server/require-hook.js:55:36
web:build: at Function._load (node:internal/modules/cjs/loader:1070:27)
web:build: at TracingChannel.traceSync (node:diagnostics_channel:322:14)
web:build: at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
web:build: at Module.<anonymous> (node:internal/modules/cjs/loader:1335:12)

Thanks for reporting. This error usually happens when Turbopack determined your project’s root directory based on a lockfile that exists further down the filesystem than where next is installed.

For example, something like this:

repo/
  package.json
  package-lock.json
  node_modules/next
  apps/
    my-app/
      package.json
      package-lock.json
      app/
        page.tsx

Here, Turbopack determined the root directory to be my-app, but Next.js is installed further up the tree.

You’ll need to either:

  • Remove the lockfile inside my-app if possible, or
  • Set turbopack.root in to next.config.js to your repository’s root directory (or wherever Next.js is installed), as described here

We’re working on a better way of communicating this problem, and exploring other approaches where the root directory can be better discovered automatically.

I’m encountering the same issue on the latest version of Next.js (15.3.2) with turborepo

Image

@Chukwu3meka Thank you for submitting an issue!

@petrch87 I was able to replicate with the latest but it looks like it is fixed with the latest canary. I had to update next to the latest canary on both Next.js apps (/app/docs and /app/web).

@Chukwu3meka Can you try updating to the latest canary?

Thanks, I can confirm that updating to next js canary version (^15.2.0-canary.69) worked for me.

@Chukwu3meka Thank you for submitting an issue!

@petrch87 I was able to replicate with the latest but it looks like it is fixed with the latest canary. I had to update next to the latest canary on both Next.js apps (/app/docs and /app/web).

@Chukwu3meka Can you try updating to the latest canary?