Error installing Sanity into existing NextJS project on Windows machine.

2 replies
Last updated: Sep 7, 2023
Hello all, I tried following the instructions to install sanity into an existing NextJS product and I was getting this error after :
npm create sanity@latest -- --project ... --dataset production --provider google

Error: Command failed with exit code 2 (ENOENT): npm install --legacy-peer-deps --save @sanity/vision@3 sanity@3 @sanity/image-url@1 styled-components@5.2
spawn cmd.exe ENOENT
I tried
npm install --legacy-peer-deps
and restarting VSCode in Windows, but still gives the same error. Someone here had the same error, but there are no replies to that question.
Sep 6, 2023, 1:32 PM
This is a Windows error having to do with permissions on your machine, not with Sanity.
Sep 6, 2023, 8:37 PM
Thank you, I just switched to another OS to install and add it to the project and then pulled the changes to the Windows machine and it worked.
Sep 7, 2023, 9:30 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?