(edited)
Current versus Expected behavior
- Current:
-
Deploying
apps/student-webfails with:Error: No Next.js version detected. Make sure your package.json has "next" in either "dependencies" or "devDependencies". Also check your Root Directory setting matches the directory of your package.json file. -
Running locally from the app directory yields the same error:
$ cd apps/student-web && vercel...Error: No Next.js version detected... -
apps/teacher-web(Vite) deploys successfully.
-
- Expected:
- Vercel detects Next.js in
apps/student-weband builds/deploys normally.
- Vercel detects Next.js in
Code, configuration, and steps that reproduce this issue
-
Monorepo with pnpm workspaces; apps are under
apps/. -
From
apps/student-web, run:vercel pull --yes --environment=preview --token=$VERCEL_TOKENvercel build --token=$VERCEL_TOKENvercel deploy --prebuilt --token=$VERCEL_TOKEN -
Observe the “No Next.js version detected” error.
apps/student-web/package.json:
{ "name": "@crabit/student-web", "version": "0.1.0", "private": true, "scripts": { "build": "next build", "check-types": "tsc --noEmit", "dev": "NEXT_PUBLIC_API_MOCKING=false next dev", "dev:mock": "NEXT_PUBLIC_API_MOCKING=true next dev", "lint": "biome check .", "start": "next start", "test": "vitest run", "test:e2e": "playwright test", "test:e2e:ui": "playwright test --ui", "test:watch": "vitest watch" }, "dependencies": { "@crabit/api": "workspace:*", "@crabit/assets": "workspace:*", "@crabit/assets-icons": "workspace:*", "@crabit/crabit-ui": "workspace:*", "@sentry/nextjs": "^9.32.0", "@t3-oss/env-nextjs": "^0.13.8", "next": "15.3.4" }, "devDependencies": { "@playwright/test": "^1.53.1", "@svgr/core": "^8.1.0", "@tsconfig/next": "^2.0.3", "@types/file-loader": "^5.0.4", "@vanilla-extract/next-plugin": "^2.4.14", "msw": "^2.10.2", "next-plugin-svgr": "^1.1.12" }, "peerDependencies": { "@hookform/resolvers": "^5", "@tanstack/react-query": "^5", "react": "^19", "react-dom": "^19", "react-hook-form": "^7", "zod": "^3" }}apps/student-web/vercel.json:
{ "framework": "nextjs" }-
apps/student-web/next.config.ts: exists; exports a validNextConfig. -
pnpm-workspace.yaml:
onlyBuiltDependencies: - sharp
packages: - apps/* - packages/* - packages/assets/*- GitHub Actions (student) excerpt:
- name: Pull Vercel Environment Information run: vercel pull --yes --environment=${{ github.event_name == 'push' && 'production' || 'preview' }} --token=${{ secrets.VERCEL_TOKEN }} working-directory: ./apps/student-web
- name: Build Project Artifacts with Vercel run: vercel build ${{ github.event_name == 'push' && '--prod' || '' }} --token=${{ secrets.VERCEL_TOKEN }} working-directory: ./apps/student-web
- name: Deploy to Vercel run: vercel deploy --prebuilt ${{ github.event_name == 'push' && '--prod' || '' }} --token=${{ secrets.VERCEL_TOKEN }} working-directory: ./apps/student-webProject information (URL, framework, environment, project settings)
- Monorepo: Turborepo + pnpm
- Package manager: pnpm 10.14.0
- Node: 22.x
- Vercel CLI: 44.7.3
- Frameworks:
apps/student-web: Next.js 15.3.4apps/teacher-web: Vite (deploys fine)
.gitignoreincludes.vercelat repo root.apps/teacher-web/.vercel/project.jsonexists and is linked.apps/student-web/.vercelwas not found at one point; runningvercelfrom that folder still shows the detection error.
What I’ve tried
- Running all Vercel commands strictly from
apps/student-web. - Ensuring
nextis independencies(not justdevDependencies). - Setting
framework: "nextjs"inapps/student-web/vercel.json. - Using
working-directory: ./apps/student-webin CI. - Verifying
next.config.tsis present and valid.
Question
- In a pnpm monorepo, why would Vercel fail to detect Next.js for
apps/student-webeven when:nextis present in that app’sdependencies,- commands run from the app directory,
- and
framework: "nextjs"is set?
- Is there a monorepo Root Directory/linking nuance I’m missing (per-app
.vercellink, dashboard Root Directory must beapps/student-web, etc.)? - Any additional settings required for pnpm workspaces so Vercel can correctly resolve the app-level
package.jsonduring build?
Title: Vercel “No Next.js version detected” for Next 15 app in pnpm monorepo under apps/student-web (teacher Vite app deploys fine)