#Expected ":" but found ")" in Vercel build

4 messages · Page 1 of 1 (latest)

sweet pebble
#

When building locally it works fine, but when building on Vercel I get:

14:25:53 [ERROR] [vite] ✗ Build failed in 27.14s
Expected ":" but found ")"

There's no other information surrounding this.

meager walrusBOT
#

Hi @sweet pebble. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The error message "Expected : but found )" is a CSS syntax error. This type of error is recognized by Astro as a CSS Syntax Error, which is typically caused by a syntax issue in your CSS (such as a missing semicolon or other malformed CSS). [CSS Syntax Error]

However, the knowledge sources don't contain enough specific information to explain why this error would appear on Vercel but not locally. A few things worth noting from the available documentation:

  1. It's a Vite build error — the [vite] ✗ Build failed prefix indicates Vite is throwing this during the build process. [Unknown Vite Error]

  2. Node.js version differences — Vercel may be using a different Node.js version than your local environment, which could affect how certain CSS or JS is processed. You can check and configure the Node.js version in your Vercel project settings. [Node.js Version Support]

  3. JS dependencies processed differently — In Astro v5, locally-linked JS dependencies are no longer processed by Vite during config loading, which can cause discrepancies between local and Vercel builds. [Upgrade to Astro v5]

Suggested steps:

#
  • Look for any CSS that uses syntax like :has(), :is(), :where(), or other pseudo-selectors that might be malformed — the error suggests a ) was found where : was expected in a CSS rule.
  • Check if a specific CSS file or <style> block is the culprit by reviewing your styles carefully.
  • Ensure your Node.js version on Vercel matches your local environment.

Unfortunately, without more context in the error output, the knowledge sources don't provide enough detail to pinpoint the exact cause. You may want to try running astro build locally with the same Node.js version as Vercel to reproduce the issue.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: