supabase/supabase-js

Can't resolve 'encoding'

thorwebdev opened this issue ยท 6 comments

Module not found: Can't resolve 'encoding' in '/Users/thorwebdev/Documents/code/supabase/quickstarts/supabase-next-13/node_modules/.pnpm/node-fetch@2.6.7/node_modules/node-fetch/lib'

This warning is printed when using supabase-js in nextjs 13 project: supabase/auth-helpers#340

It's related to an old version of node-fetch being used in cross-fetch: node-fetch/node-fetch#412 lquixada/cross-fetch#146

It should be safe to ignore as it's an optional dependency in node-fetch, but might be worthwhile to see if we can get rid of the warning.

I'm seeing the same issue.

Module not found: Can't resolve 'encoding' in '/Users/cdedreuille/Sites/kapture/node_modules/node-fetch/lib'

Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/cross-fetch/dist/node-ponyfill.js
./node_modules/@supabase/supabase-js/dist/main/lib/fetch.js
./node_modules/@supabase/supabase-js/dist/main/SupabaseClient.js
./node_modules/@supabase/supabase-js/dist/main/index.js
./lib/supabase.ts
./app/app/page.tsx

./node_modules/node-fetch/lib/index.js
Module not found: Can't resolve 'encoding' in '/Users/cdedreuille/Sites/kapture/node_modules/node-fetch/lib'

Import trace for requested module:
./node_modules/node-fetch/lib/index.js
./node_modules/cross-fetch/dist/node-ponyfill.js
./node_modules/@supabase/supabase-js/dist/main/lib/fetch.js
./node_modules/@supabase/supabase-js/dist/main/SupabaseClient.js
./node_modules/@supabase/supabase-js/dist/main/index.js
./lib/supabase.ts
./app/app/components/image.tsx
./app/app/components/grid.tsx

Everything is working as expected but it would be great to make it go away.

Yes, am getting the same with the latest Nextjs 13.1.6. Everything works though.

I am using node 18+ version, It does not need cross-fetch.

pnpm add -D encoding

With this you can run.

Any update on this one @thorwebdev ?

@cdedreuille no update so far, but I'll take a look this week.

As @kamto7 suggested, using npm:
npm i -D encoding
Removes the error. I'm going to test a deployment on Vercel later this week to see if i'm able to deploy successfully.