Next.js build: "Module not found: Can't resolve 'ai/react'" with Vercel AI SDK 5+/7: useChat moved to the separate @ai-sdk/react package
Install the React bindings separately and change the import: npm i @ai-sdk/react, then import { useChat } from '@ai-sdk/react'. Since AI SDK 5 the ai package doesn't ship the ai/react subpath any more. In ai 7.0.173 its exports map only has ., ./internal, ./test and ./package.json, so Next.js/Turbopack reports Module not found: Can't resolve 'ai/react' even though ai is installed. The current pairing is ai 7.0.x with @ai-sdk/react 4.0.x (latest 7.0.173 / 4.0.177). @ai-sdk/react peers on react ^18 or ^19.0.1+. Fixing the import is only the first error you'll see. The hook it gives you is the new transport-based useChat (no input/handleSubmit; uses sendMessage and DefaultChatTransport), and the server route must return a UI-message stream, not the old data stream. Plan to migrate the client component and the route handler together. ai/rsc and ai/svelte are gone from the ai package too, so search the codebase for from 'ai/ before you upgrade.