Yarn SyntaxError: Missing ) After Argument List
This is a Windows-specific issue where Node.js is trying to execute a Unix shell script directly. The error happens because the .bin/sanity file in your node_modules contains bash syntax (basedir=$(dirname...)) that Node.js can't parse on Windows.
This is actually a broader Node.js/npm ecosystem issue on Windows where the wrong executable wrapper gets invoked. When you run yarn sanity dev (or any sanity command), yarn should be using the Windows-compatible .cmd wrapper file, but instead it's trying to execute the Unix shell script, which causes Node.js to choke on the bash syntax.
Potential solutions to try:
Use the .cmd extension explicitly in your package.json scripts:
{ "scripts": { "dev": "sanity.cmd dev", "build": "sanity.cmd build" } }Run commands with the .cmd extension directly in your terminal:
yarn sanity.cmd devSwitch to npm for this project, as some users have reported this being a yarn-specific path resolution issue on Windows. Delete your
node_modulesandyarn.lock, then:npm install npm run devCheck your Node.js version - Make sure you're on a recent LTS version (Node 20+ is required for Sanity Studio v4 according to the breaking changes documentation). Sometimes path resolution issues in
.binwrappers can be version-specific.Try running the command through npx as an alternative:
npx sanity devClear and reinstall - Sometimes the
.binwrappers get corrupted during installation:rm -rf node_modules rm yarn.lock yarn install
The fact that you're seeing this with the latest preview version and with yarn specifically (when others report it working with yarn) suggests this might be an edge case in how the CLI binaries are being generated for Windows in that preview build. If none of these solutions work, I'd recommend reporting this on the Sanity GitHub repository with your exact Node.js version, yarn version, and Windows version so the team can investigate the preview build's Windows compatibility.
Sanity β Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.