treefarmstudio / astro-sanity

This is a helper package to integrate Astro and Sanity
https://www.npmjs.com/package/astro-sanity
MIT License
102 stars 10 forks source link

Module not found error using pnpm #14

Open valse opened 1 year ago

valse commented 1 year ago

Hi, first of all thanks for this amazing library: I'm a huge fan of Sanity and, for a simple project, I'd like to try it with Astro!

I installed it and I'm using the pnpm package manager but, on start, I get the Cannot find module '@sanity/client' imported from 'virtual:sanity-init' error... to solve it I need to add the @sanity/client dependency manually.

I tried with yarn and it works as expected... I don't know if this is an expected behavior 🤔

Thanks valse

nimser commented 1 year ago

I confirm this. Also using pnpm here. Didn't fail when installing with npm instead of pnpm.

dvsqz commented 1 year ago

You may need to create a .npmrc at the root of your project with the following content so that pnpm automatically installs peer dependencies:

auto-install-peers=true

Reference: https://github.com/pnpm/pnpm/discussions/3995#discussioncomment-2797582

If that doesn't work I've seen others use this: shamefully-hoist=true

roblet404 commented 1 year ago

Second one worked for me

shamefully-hoist=true