marmelab / ra-supabase

Supabase adapter for react-admin, the frontend framework for building admin applications on top of REST/GraphQL services.
MIT License
150 stars 27 forks source link

Can't resolve '@raphiniert/ra-data-postgrest' #48

Closed Revarh closed 8 months ago

Revarh commented 8 months ago

Hello Marmelab team,

I installed the latest version of supabase-js to a new, clean RA project, and I have this error:

ERROR in ./node_modules/ra-supabase-core/esm/dataProvider.js 117:0-66 Module not found: Error: Can't resolve '@raphiniert/ra-data-postgrest' in 'C:\Users.......\node_modules\ra-supabase-core\esm'

So I have to add @raphiniert/ra-data-postgrest to my package, which you don't do in your demo. Why ? Also, I cannot install the latest @raphiniert/ra-data-postgrest version (2.0.0) as it creates error. Only version 1.2.0 works.

Here is a test repo: https://github.com/Revarh/test_bug_supabase-js

Kind regards

Revarh commented 8 months ago

I have been investigating a little bit more. When I look into your repo ra-supabase/packages/ra-supabase-core/package.json I correctly find:

"peerDependencies": {
        "@raphiniert/ra-data-postgrest": "^2.0.0",
        "@supabase/supabase-js": "^2.0.0",
        "ra-core": "^4.7.0"
    },

And when I explore dataProvider.js I also find that you indeed use the latest changeLogs advice from @raphiniert/ra-data-postgrest. I also see that it install @supabase/supabase-js so I don't have to do it. And it seems perfect.

Then why when I do yarn add ra-supabase I do not find the same peer depencies? More, when I go to my node_modules and explore ra-supabase-core/src/dataProvider.ts I do not find the same code working with @raphiniert/ra-data-postgrest 2.0.0, but the one working with @raphiniert/ra-data-postgrest 1.2.0

If there is a workaround to make all this work, please explain because that is really not clear...

Regards

Revarh commented 8 months ago

So I finally got to the bottom of it: yarn add ra-supabase was not installing properly. Whereas npm install ra-supabase installed it correctly.