KyselyK
Kysely3y ago
tzezar

cant use kysely-codegen

I followed this part https://kysely.dev/docs/getting-started of documentation till CODEGEN part when you can generate types based on actual database. https://kysely.dev/docs/generating-types this one. I installed needed packages: npm install --save-dev kysely-codegen, and I set database string in
.env
file. Next step is: kysely-codegen, but I get this error when I type it in the console:

kysely-codegen
kysely-codegen : The term 'kysely-codegen' is not recognized as the name of a cmdlet, function, script file, o 
r operable program. Check the spelling of the name, or if a path was included, verify that the path is correct 
 and try again.
At line:1 char:1
+ kysely-codegen
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (kysely-codegen:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


any help please?
To work with Kysely, you're required to provide a database schema type definition to the Kysely constructor.
Solution
oh I feel stupid... npx kysely-codegen works
Was this page helpful?