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

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.

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

Source: https://github.com/vercel/vercel/issues/3767