node.jspostgresqlprismamonorepoturborepo

prisma generate problem ( The "path" argument must be of type string. Received undefined )


hello guys i recently workings on a nextjs project ( turborepo - monorepo ) and after few minutes i realized that i have to add new column in my table

so i just updated my schema.prisma by adding a line ( createdAt DateTime) then after running npx prisma migrate dev it says you can generate the prisma client but as we run npx prisma generate it says

PS D:\GitHub\my-turborepo\packages\db> npx prisma generate

Environment variables loaded from .env Prisma schema loaded from prisma\schema.prisma Error: The "path" argument must be of type string. Received undefined

The Solution is

Step - 1 : Open Task manager

Step - 2 : Kill node.js runtime

Step - 3 : Kill VsCode ( save changes before killing)

Step - 4 : Open Vs code and before npm run dev run npx prisma generate in your db or main folder of database

And All set :) tell me if it work for you or not

Also if someone know how to fix this in MAC so help others too...


Solution

  • I encountered the Prisma error "The 'path' argument must be of string. Received undefined". A complete reinstallation of packages resolved the issue: bashCopy# Remove existing packages npm uninstall @prisma/client prisma

    Reinstall packages

    npm install prisma --save-dev npm install @prisma/client

    Generate Prisma client

    npx prisma generate --schema=./prisma/schema.prisma # If schema is in custom location

    OR

    npx prisma generate # If you're in directory containing prisma/