X
Xata8mo ago
Gold240sx

Xata Starter Guide Next.JS trouble

Just following allong with the Getting Started with Next.js and Xata guide and I'm getting this error:
"npm:@xata.io/client@latest
Module build failed: UnhandledSchemeError: Reading from "npm:@xata.io/client@latest" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "npm:" URIs."
"npm:@xata.io/client@latest
Module build failed: UnhandledSchemeError: Reading from "npm:@xata.io/client@latest" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "npm:" URIs."
on the step where I'm replacing the content in the home page here:
"Next, import the auto-generated getXataClient function from src/xata.ts, get all the posts using the client, and list them within the page:

src/app/page.tsx
import { getXataClient } from '@/xata';
const xata = getXataClient();
export default async function Home() {
const posts = await xata.db.Posts.getAll();
return (
<>
<div className="w-full max-w-5xl mt-16">
{posts.length === 0 && <p>No blog posts found</p>}
{posts.map((post) => ("

"Next, import the auto-generated getXataClient function from src/xata.ts, get all the posts using the client, and list them within the page:

src/app/page.tsx
import { getXataClient } from '@/xata';
const xata = getXataClient();
export default async function Home() {
const posts = await xata.db.Posts.getAll();
return (
<>
<div className="w-full max-w-5xl mt-16">
{posts.length === 0 && <p>No blog posts found</p>}
{posts.map((post) => ("

I'm getting a TS error saying: "Property 'db' does not exist on type 'XataClient'.ts(2339)" and also in my xata.ts file autogenerated, I'm getting the errors: "Cannot find module or its corresponding type declarations." and Cannot find module 'npm:@xata.io/client@latest' or its corresponding type declarations. "
1 Reply
kostas
kostas8mo ago
Hi! Seems like the @xata.io/client has not been installed. The xata client is installed by the CLI during xata init, which automatically downloads the client module in the local node_modules directory within your project folder. Is @xata.io/client listed in the dependencies of the package.json in "xata-nextjs"? If not, it's likely that some commands where not run in the same order as in the guide or that the npm package manager isn't well configured. Try: npm install @xata.io/client --save in the "xata-nextjs" folder. This is the same command that the Xata CLI (during xata init) should run. Also, make sure you've installed node.js and npm and running a recent version (npm --version) of npm (npm update -g) - unless you're explicitly using an alternative package manager other than npm.
Want results from more Discord servers?
Add your server