๐Ÿ”ฎ Sanity Create is here. Writing is reinvented. Try now, no developer setup

TypeError when running `npm run dev` in a fresh install of Sanity.io

11 replies
Last updated: Jan 10, 2024
Hey all, so I'm trying to install sanity@latest and everything runs fine on the initial setup. But, upon running
npm run dev
I'm met with a TypeError:
Cannot read properties of undefined (reading 'toLowerCase')
mind you this is a fresh install and I have not written a single line yet. Any thoughts?
Oct 18, 2023, 5:21 PM
This is what the error looks like upon running
npm run dev
Oct 18, 2023, 5:31 PM
Are you on the latest version of the CLI? What does your
sanity.config
file look like?
Oct 18, 2023, 10:40 PM
The latest version of the CLI and it's the default config. I haven't changed a single line and it looks like the error is coming from the node modules.
Oct 18, 2023, 11:18 PM
Hi, I have the same issiue. I'm just following the Sanity Crash Course tutorial.
Oct 19, 2023, 1:16 PM
I too have this issue with a fresh project following Getting Started guide.
Oct 19, 2023, 5:05 PM
I resolved this by going to
node_modules/framer-motion/dist/cjs/index.js
line 4223 and changing from:
navigator.userAgent.toLowerCase().includes(string);
to:

navigator?.userAgent?.toLowerCase().includes(string);

It was then possible to get the development server up and running
Oct 19, 2023, 5:32 PM
I will definitely give that a try and keep you posted.
Oct 19, 2023, 7:48 PM
user R
that worked like a charm, thank you so much!!
Oct 19, 2023, 8:35 PM
This was also my problem! Thanks a lot ๐Ÿ‘
Oct 20, 2023, 4:07 PM
Same issue here I had to
pnpm patch
framer-motion as
user R
did.
Oct 24, 2023, 12:58 PM
Thanks to
user R
for pointing this out, had exactly the same problem. BUT just to clarify the file has been updated & is now on line 4257
Jan 10, 2024, 4:36 PM

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?