Fix install problems
Fix a failed shadcn install, imports that do not resolve, a missing tooltip provider, and a grid that renders nothing or without styles.
Find your symptom below. The sections cover a failed install, a broken import, and a grid that does not render. The shadcn CLI copies gridcn source into your project. Most problems come from the CLI setup or your path mapping. To install gridcn, see Install gridcn.
Install from the GitHub registry
If the CLI does not know the @gridcn namespace, it stops with Unknown registry "@gridcn". Make sure it is defined under "registries" in your components.json or package.json file. Install from the GitHub registry path instead. It needs no namespace:
pnpm dlx shadcn add DammersCode/gridcn/data-grid
The CLI resolves the ref with git ls-remote and reads the files from raw.githubusercontent.com. Without git, it uses the GitHub API.
To pin a tag, branch, or commit, append #<ref> to the item name. Install the core with the ref first, then each add-on with the same ref. See Pinned installs.
Mirror the registry
A registries entry in components.json maps a namespace to a URL, and it wins over the hosted @gridcn registry. To serve gridcn from your own host:
- Copy the
public/r/*.jsonfiles of a gridcn release to your host. - Add the namespace to
components.json:
{
"registries": {
"@gridcn": "https://registry.example.com/r/{name}.json"
}
}The URL must contain {name}. Plain names such as popover in registryDependencies still come from the shadcn registry.
Install in a monorepo
Run the CLI for the app that renders the grid. Pass its folder with -c, for example npx shadcn add @gridcn/data-grid -c apps/web. The CLI reads the components.json of that folder. The gridcn files land under its aliases.components, and their imports use its aliases. If the shadcn primitives live in a shared package, point aliases.ui and aliases.utils at the import paths that the app resolves for that package.
Fix imports that do not resolve
The CLI rewrites the imports of gridcn files with the aliases of your components.json. If your project does not map those aliases, the imports stay unresolved. To fix them:
- If
components.jsonis missing, runnpx shadcn init. - Set
aliases.components,aliases.ui, andaliases.utilsincomponents.json. - Map the same prefix in the path settings of your project, as the next sections show.
- Edit the remaining wrong import lines by hand. The installed files belong to you.
Next.js
Set "@/*": ["./*"] in compilerOptions.paths of tsconfig.json. If your code lives in src, use ["./src/*"].
Vite
Add the alias to vite.config.ts:
import path from "node:path";
import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: { "@": path.resolve(import.meta.dirname, "./src") },
},
});Add the same alias to compilerOptions.paths in tsconfig.app.json.
Find the installed files
Files land under aliases.components of components.json, in @/components by default. The core lands in components/data-grid/*. Import from the barrel file data-grid.tsx:
import { DataGrid, defineColumns } from "@/components/data-grid/data-grid";Each add-on has its own folder with the same pattern, for example components/data-grid-history/data-grid-history.ts. The hook and utility items, such as use-debounce, land in components/gridcn/. The core also writes components/data-grid/LICENSE.md.
Keep your components/ui files
The core depends on shadcn/ui primitives such as button and popover. If a file already exists in components/ui, the CLI asks The file <path> already exists. Would you like to overwrite?. Answer no to keep your version. Run npx shadcn add @gridcn/data-grid --dry-run first to list each file marked overwrite.
Add a tooltip provider
The CLI prints a hint to wrap your app in TooltipProvider. The grid works without it. The core shows the message of an invalid cell in a tooltip, and the context menu shows one on a disabled item.
Without a provider a tooltip opens after 600 ms. The TooltipProvider of shadcn/ui sets the delay to 0. To open tooltips at once, wrap your app in one provider:
import type { ReactNode } from "react";
import { TooltipProvider } from "@/components/ui/tooltip";
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
<TooltipProvider>{children}</TooltipProvider>
</body>
</html>
);
}Verify the install
Render the grid from Render your first grid. Click a cell, type a value, and press Enter. The cell keeps the new value, and the active cell moves down one row. The grid renders your rows with styles. If it does not, read the next section.
Fix an empty or unstyled grid
If the grid renders nothing, shows no rows, or has no styles, check these causes:
- The grid shows "No rows" although your rows exist.
defaultDataseeds the grid once, so rows that arrive later never show, and the grid warns in development. Pass them indatawithonDataChangeinstead. - The page throws "a row has no string or number
idfield". Add anidto each row, or passgetRowId. - The grid has no styles. Check that your global CSS imports Tailwind and that the base tokens of shadcn/ui exist. The grid reads tokens such as
--backgroundand--border. The CLI adds--grid-pin-shadowand--search-highlightfor light and dark mode. - The grid fails or loses its styles on an older stack. gridcn needs React 19 and Tailwind v4. See Framework floors.
- The grid draws 200 rows and, in a development build, warns in the console when the viewport covers more than 200 rows. Give it a fixed height, for example
className="h-96".