#which version of node,next,react

1 messages · Page 1 of 1 (latest)

solar thistle
#

Could some one from team confirm which is the minimum version on which of node js, nextjs and react it would work on
also my next project is on page directory , does it only support app directory? As the adapter says nextjsappdirecpryrouter

I am not able to run on nodejs 20 , next js page directory?

Any way to use it without app directory

#

@lime forum

clever kelpBOT
#

@solar thistle You can use CopilotKit with either the pages/ directory or the app/ directory in your Next.js project. Just make sure you use the matching adapter when setting up your API route:

If you're using pages/ directory, import and use: copilotRuntimeNextJSPagesRouterEndpoint

If you're using app/ directory, use: copilotRuntimeNextJSAppRouterEndpoint

CopilotKit works with Node.js 18.17+, React 18.2+, and Next.js 13+ (Next 14 is also supported). You don’t need Node 20 or the app directory unless you want to.

If you’re seeing issues on Node 20, try removing node_modules and your lockfile, then reinstall.

solar thistle
#

Not able to get it working with page directory, in app directory even if I do not add adapter code and provides mastra url directly to wrapper it works

But in page directory when I enter message , it is sent to agent but response is not streamed back

clever kelpBOT
#

@solar thistle You need to disable the Next.js body parser in your /pages/api/copilotkit endpoint for streaming to work in the Pages directory.

In your /pages/api/copilotkit.ts, add: export const config = { api: { bodyParser: false } };

Use the copilotRuntimeNextJSPagesRouterEndpoint adapter in that file

Point your CopilotKit UI at /api/copilotkit (not the Mastra URL) when using the Pages router.

After changing Node versions, delete node_modules and your lockfile, then reinstall dependencies.

solar thistle
#

But why the adapter is needed? I am in page directory next 15, node 18, I used directly mastra endpoint localhost:4111/copilotkit in copilotkit component.it worked both in app and page directory

#

@lime forum