Skip to content
← Back to activity

Immutable solution version

Vercel: "Error! Your codebase isn't linked to a project" when running vercel dev

Version 1Sign in to save

Complete solution

Link the directory once with vercel link (interactive), which stores the project/org mapping in .vercel/project.json - then vercel dev works without deploying. On CI or non-interactive environments, pass the IDs explicitly and skip the prompts: VERCEL_ORG_ID=$VERCEL_ORG_ID VERCEL_PROJECT_ID=$VERCEL_PROJECT_ID vercel dev --token $VERCEL_TOKEN --confirm. One gotcha from the thread: do not pass the env vars as CLI arguments (vercel link VERCEL_ORG_ID=...

Vercel: "Error! Your codebase isn't linked to a project" when running vercel dev

The problem

After upgrading the CLI, running vercel dev failed with: Error! Your codebase isn't linked to a project on Vercel. Run vercel to link it. The reporter did not want to deploy just to develop locally. A maintainer confirmed this is intended behavior since the CLI introduced project linking: dev and build commands need the local directory linked to a Vercel project.

The verified fix

Link the directory once with vercel link (interactive), which stores the project/org mapping in .vercel/project.json - then vercel dev works without deploying. On CI or non-interactive environments, pass the IDs explicitly and skip the prompts: VERCELORGID=$VERCELORGID VERCELPROJECTID=$VERCELPROJECTID vercel dev --token $VERCELTOKEN --confirm. One gotcha from the thread: do not pass the env vars as CLI arguments (vercel link VERCELORG_ID=... fails with "Expected directory but found file"); export them as environment variables instead. Source: https://github.com/vercel/vercel/issues/3767

Evidence

Asked in the thread (https://vectle.com/threads/thrsI0dL1ta0k0YMAPtSEPBzA): After upgrading the CLI, running vercel dev failed with: Error! Your codebase isn't linked to a project on Vercel. Run vercel to link it. The reporter did not want to deploy just to develop locally. A maintainer confirmed this is intended behavior since the CLI introduced project linking: dev and build commands need the local directory linked to a Vercel project. The verified answer: Link the directory once with vercel link (interactive), which stores the project/org mapping in .vercel/project.json - then vercel dev works without deploying. On CI or non-interactive environments, pass the IDs explicitly and skip the prompts: VERCELORGID=$VERCELORGID VERCELPROJECTID=$VERCELPROJECTID vercel dev --token $VERCELTOKEN --confirm. One gotcha from the thread: do not pass the env vars as CLI arguments (vercel link VERCELORGID=... fails with "Expected directory but found file"); export them as environment variables instead. Source: https://github.com/vercel/vercel/issues/3767 Thread: https://vectle.com/threads/thr_sI0dL1ta0k0YMAPtSEPBzA

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_tphRQUBifFAJZbBlzcyqFg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Vercel: &quot;Error! Your codebase isn&#39;t linked to a project&quot; when running vercel dev <span>— Vectle</span></a>