You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a new Sanity project using the following command:
pnpm create sanity@latest -- --template clean --create-project "project" --dataset production
The @sanity/client package is not added to the package.json dependencies. Once npx sanity@latest typegen generate is executed, building or deploying the project, triggers a TypeScript error Type error: Invalid module name in augmentation, module '@sanity/client' cannot be found.
To Reproduce
Steps to reproduce the behavior:
Create a new Next.js app. My project uses ▲ Next.js 15.0.3 (Turbopack):
pnpm create next-app@latest --ts
Run the following command to create a new Sanity project:
pnpm create sanity@latest -- --template clean --create-project "mueller" --dataset production
Answer the following prompts during the setup process:
? Would you like to add configuration files for a Sanity project in this Next.js folder? Yes
╭────────────────────────────────────────────────────────────╮
│ │
│ It looks like you are using Next.js 15 and React 19 │
│ Please read our compatibility guide. │
│ https://www.sanity.io/help/react-19 │
│ │
╰────────────────────────────────────────────────────────────╯
? Do you want to use TypeScript? Yes
? Would you like an embedded Sanity Studio? Yes
? What route do you want to use for the Studio? /studio
? Select project template to use Blog (schema)
? Would you like to add the project ID and dataset to your .env.local file? Yes
Inspect the package.json file. The @sanity/client package is missing.
Generate types using the command:
npx sanity@latest typegen generate
Attempt to build the project. An error occurs due to the missing @sanity/client package:
./sanity.types.ts:182:16
Type error: Invalid module name in augmentation, module '@sanity/client' cannot be found.
Expected behavior
The @sanity/client package should be included in the package.json dependencies when creating a new project, as it is required for type generation and proper deployment.
Describe the bug
When creating a new Sanity project using the following command:
pnpm create sanity@latest -- --template clean --create-project "project" --dataset production
The
@sanity/client
package is not added to thepackage.json
dependencies. Oncenpx sanity@latest typegen generate
is executed, building or deploying the project, triggers a TypeScript errorType error: Invalid module name in augmentation, module '@sanity/client' cannot be found
.To Reproduce
Steps to reproduce the behavior:
Create a new Next.js app. My project uses
▲ Next.js 15.0.3 (Turbopack)
:Run the following command to create a new Sanity project:
pnpm create sanity@latest -- --template clean --create-project "mueller" --dataset production
Answer the following prompts during the setup process:
Inspect the
package.json
file. The@sanity/client
package is missing.Generate types using the command:
Attempt to build the project. An error occurs due to the missing
@sanity/client
package:Expected behavior
The
@sanity/client
package should be included in thepackage.json
dependencies when creating a new project, as it is required for type generation and proper deployment.Example of running the command where the package was not added
Screenshots
Example error during deployment:
Which versions of Sanity are you using?
What operating system are you using?
Which versions of Node.js / npm are you running?
Additional context
Adding
@sanity/client
manually to thepackage.json
file resolves the issue:Commit fixing the issue by adding the missing package
This package should be included by default when setting up a new project using the
pnpm create sanity@latest
command.The text was updated successfully, but these errors were encountered: