'error states Unable to require(node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node) while npx performing prisma generate

I have a node.js project with prisma as ORM that connects to postgresdb. After I installed dependencies with yarn install I tried to run command npx prisma generate then I got error stating Unable to require(/node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node) libssl.so.1.1: cannot open shared object file: No such file or directory.

local setup

I have ubuntu 22.04 with node version of v16.14.2.



Solution 1:[1]

You would need to add an option of binaryTargets in generator block in your schema.prisma file as mentioned in docs.

Adding debian-openssl-1.1.x to your generator should solve your issue.

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["debian-openssl-1.1.x"]
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nurul Sundarani