Describe the bug
I'm encountering an issue while trying to initialize Sanity for a Next.js project. The install-peerdeps command fails with a permission error despite multiple attempts with different approaches. Here are the details:
To Reproduce
Steps to reproduce the behavior:
1.Install a next boilerplate
git clone https://github.com/next-enterprise.git
cd next-enterprise
yarn install --frozen-lockfile
-
Install sanity over the next project
npx sanity@latest init --env --create-project "Next.js Live Preview" --dataset production
-
Answering CLI questions like this :
- Would you like to add configuration files for a Sanity project in this Next.js folder? Yes
- 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 Clean project with no predefined schema types
- Would you like to add the project ID and dataset to your .env file? Yes
Expected behavior
The command should init & install all necessary peer dependencies for sanity inside the existing nextjs project
Which versions of Sanity are you using?
sanity: command not found
What operating system are you using?
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
Which versions of Node.js / npm are you running?
Run npm -v && node -v in the terminal and copy-paste the result here.
npm 10.8.1
node v20.15.0
Additional context
This is the last lines of the console output :
install-peerdeps v3.0.3
Installing peerdeps for next-sanity@9.
yarn add next-sanity@9.4.2 @sanity/client@^6.20.1 @sanity/icons@^3.0.0 @sanity/types@^3.37.1 @sanity/ui@^2.0.11 next@^15.0.0 react@^19.0.0 sanity@^3.37.1 styled-components@^6.1
ERR undefined
Error: Command failed with exit code 1 (EPERM): npx install-peerdeps --yarn next-sanity@9
at makeError$1 (~/.npm/_npx/7c099b67f9967cde/node_modules/@sanity/cli/lib/_chunks-cjs/cli.js:17897:32)
at ~/.npm/_npx/7c099b67f9967cde/node_modules/@sanity/cli/lib/_chunks-cjs/cli.js:18238:29
at async initSanity (~/.npm/_npx/7c099b67f9967cde/node_modules/@sanity/cli/lib/_chunks-cjs/cli.js:44389:110)
Describe the bug
I'm encountering an issue while trying to initialize Sanity for a Next.js project. The install-peerdeps command fails with a permission error despite multiple attempts with different approaches. Here are the details:
To Reproduce
Steps to reproduce the behavior:
1.Install a next boilerplate
git clone https://github.com/next-enterprise.gitcd next-enterpriseyarn install --frozen-lockfileInstall sanity over the next project
npx sanity@latest init --env --create-project "Next.js Live Preview" --dataset productionAnswering CLI questions like this :
Expected behavior
The command should init & install all necessary peer dependencies for sanity inside the existing nextjs project
Which versions of Sanity are you using?
sanity: command not found
What operating system are you using?
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
Which versions of Node.js / npm are you running?
Run
npm -v && node -vin the terminal and copy-paste the result here.npm 10.8.1
node v20.15.0
Additional context
This is the last lines of the console output :