When running npm install or npx prisma generate on Windows, you may encounter this error:
A required privilege is not held by the client. (os error 1314)
This happens because Prisma tries to create a symlink from node_modules/@prisma/client to the custom output directory, which requires administrator privileges on Windows.
This is the easiest and most permanent solution:
- Open Settings (Windows key + I)
- Go to Privacy & Security → For developers
- Enable Developer Mode
- Restart your terminal/PowerShell
- Run
npx prisma generateagain
Developer Mode allows Windows to create symlinks without administrator privileges.
- Right-click on your terminal/PowerShell
- Select Run as administrator
- Navigate to your project directory
- Run
npx prisma generate
If the above options don't work, you can manually generate the Prisma client:
npx prisma generateIf it still fails, you can temporarily work around it by:
- Delete the
src/generateddirectory if it exists - Run
npx prisma generatewith administrator privileges - The generated files will work even after closing the admin terminal
If you have WSL installed, you can run the project in a Linux environment where symlinks work without issues:
wsl
cd /mnt/e/Projects/sous-chef # Adjust path as needed
npm install
npx prisma generateAfter running npx prisma generate, verify it worked by checking:
- The
src/generated/prismadirectory exists - The
src/generated/prisma/clientdirectory contains Prisma client files - Your IDE can resolve imports from
@/generated/prisma/client
- The
postinstallscript inpackage.jsonwill attempt to generate Prisma client automatically afternpm install, but it will fail gracefully if symlink creation is not possible - You can always run
npx prisma generatemanually after installation - This issue only affects Windows; Linux and macOS don't have this restriction