NextJS build error

Hello, I'm trying to run the NextJS project build with better-auth but I'm getting the error. Could someone help me?
Failed to compile.

./node_modules/better-auth/dist/client/react/index.mjs
Attempted import error: 'useRef' is not exported from 'react' (imported as 'useRef').

Import trace for requested module:
./node_modules/better-auth/dist/client/react/index.mjs
./src/lib/auth-client.ts

./node_modules/better-auth/dist/client/react/index.mjs
Attempted import error: 'useSyncExternalStore' is not exported from 'react' (imported as 'useSyncExternalStore').

Import trace for requested module:
./node_modules/better-auth/dist/client/react/index.mjs
./src/lib/auth-client.ts
Failed to compile.

./node_modules/better-auth/dist/client/react/index.mjs
Attempted import error: 'useRef' is not exported from 'react' (imported as 'useRef').

Import trace for requested module:
./node_modules/better-auth/dist/client/react/index.mjs
./src/lib/auth-client.ts

./node_modules/better-auth/dist/client/react/index.mjs
Attempted import error: 'useSyncExternalStore' is not exported from 'react' (imported as 'useSyncExternalStore').

Import trace for requested module:
./node_modules/better-auth/dist/client/react/index.mjs
./src/lib/auth-client.ts
No description
1 Reply
Elnatal
Elnatal2w ago
Add "use client" to auth-clent.ts file.

Did you find this page helpful?