Quilker
Quilker2mo ago

Can't setup migrations -Module '"./_generated/api.js"' has no exported member 'components'.ts(2305)

When setting up migrations (following this doc: https://www.convex.dev/components/migrations) After installing the package and defining my convex.config.ts (I did not have a config.ts before this, so I created one) while trying to add this code to convex/migrations.ts, I get a ts error
import { Migrations } from "@convex-dev/migrations";
import { components } from "./_generated/api.js";
import { DataModel } from "./_generated/dataModel.js";

export const migrations = new Migrations<DataModel>(components.migrations);
export const run = migrations.runner();
import { Migrations } from "@convex-dev/migrations";
import { components } from "./_generated/api.js";
import { DataModel } from "./_generated/dataModel.js";

export const migrations = new Migrations<DataModel>(components.migrations);
export const run = migrations.runner();
line 2 errors with Module '"./_generated/api.js"' has no exported member 'components'.ts(2305) I have npx convex dev running (no issues) my _generated/api.js and api.d.ts are in screenshots.
No description
No description
No description
2 Replies
ian
ian2mo ago
Make sure to be running npx convex dev after you add the convex.config.ts - the components bit is added by codegen when it first detects a component
Quilker
QuilkerOP2mo ago
yeah thanks this works now. no idea why it didn't before.

Did you find this page helpful?