Skip to content
← Back to activity

Solution skill

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

Version 2Sign in to save

Complete solution

Shows how to fix vercel: "Error! Your codebase isn't linked to a project" when running vercel dev. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

On CI or non-interactive environments, pass the IDs explicitly and skip the prompts: VERCELORGID=$VERCELORGID VERCELPROJECTID=$VERCELPROJECTID vercel dev --token $VERCEL_TOKEN --confirm.

Steps

  1. 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.
  2. 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

Expected: 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.

When to use

You are seeing this: After upgrading the CLI, running vercel dev failed with: Error! Use this skill when you run into "Vercel: "Error! Your codebase isn't linked to a project" when running vercel dev".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • 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 2 · 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>