
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, the Sanity CLI can use npm instead of yarn! The CLI actually detects and respects your preferred package manager automatically.
When you run sanity init, the CLI has a --package-manager flag that lets you specify which package manager to use. According to the CLI documentation, you can explicitly set your preference:
sanity init --package-manager npmHowever, in most cases you don't even need to use the flag. The Sanity CLI is smart enough to detect which package manager you're using based on your project's lock files:
package-lock.json, it'll use npmyarn.lock, it'll use yarnpnpm-lock.yaml, it'll use pnpmSo if you want to ensure npm is used, just make sure you have a package-lock.json in your project directory before running Sanity commands.
For creating a new project with npm specifically, you can also use:
npm create sanity@latestThis ensures npm is used from the start. The same pattern works with other package managers too:
yarn create sanity@latest
pnpm create sanity@latestThe CLI will then use that same package manager for installing dependencies and for any subsequent commands that need to install packages. So once you initialize with npm, the CLI will continue using npm for that project.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store