Next.js Discord

Discord Forum

error: Duplicate dependency: "tsconfig" specified in package.json

Unanswered
Siamese posted this in #help-forum
Open in Discord
SiameseOP
I have a nextjs (v14) project in a turborepo monorepo, but when I try to deploy to vercel it I get: error: Duplicate dependency: "tsconfig" specified in package.json but don't get this issue locally when doing dev / lint / build. How can I fix it?

root package.json
{
  "private": true,
  "scripts": {
    "build": "turbo run build",
    "dev": "turbo run dev",
    "lint": "turbo run lint",
    "format": "prettier --write \"**/*.{ts,tsx,md}\""
  },
  "devDependencies": {
    "eslint": "^8.48.0",
    "prettier": "^3.0.3",
    "tsconfig": "workspace:*",
    "turbo": "latest"
  },
  "name": "bonfire",
  "packageManager": "bun@1.0.7",
  "workspaces": [
    "apps/*",
    "packages/*"
  ]
}


nextjs package.json
{
  "name": "web",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "react": "^18",
    "react-dom": "^18",
    "next": "14.0.0",
    "database": "workspace:*"
  },
  "devDependencies": {
    "@next/eslint-plugin-next": "^14.0.0",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10",
    "postcss": "^8",
    "tailwindcss": "^3",
    "eslint-config-custom": "workspace:*",
    "typescript": "^5.0.0",
    "tsconfig": "workspace:*"
  }
}

4 Replies

SiameseOP
I tried having it so only the root package.json had the tsconfig devDependency, but that didn't fix it; same issue unfortunately.

And in the turborepo example, they have the root and children package.json both have the tsconfig dependency so I'm not sure what's up
SiameseOP
Oh interesting, I removed it from the root package, and it gets past that error now?
Still not entirely sure I understand why that's causing issues
example turborepo has it in all 3