Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prisma query engine not found on mac M1

I'm having an issue with running Prisma in my project. Running npx prisma generate works, but then running my app I get:

/Users/user/Desktop/project/node_modules/@prisma/client/runtime/index.js:36466
4:29:05 PM web.1 |        throw new PrismaClientInitializationError(errorText, this.config.clientVersion);
4:29:05 PM web.1 |              ^
4:29:05 PM web.1 |  PrismaClientInitializationError: Query engine library for current platform "darwin" could not be found.
4:29:05 PM web.1 |  You incorrectly pinned it to darwin
4:29:05 PM web.1 |  This probably happens, because you built Prisma Client on a different platform.
4:29:05 PM web.1 |  (Prisma Client looked in "/Users/user/Desktop/project/node_modules/@prisma/client/runtime/libquery_engine-darwin.dylib.node")

I've noticed that the libquery_engine-darwin.dylib.node file actually exists as libquery_engine-darwin-arm64.dylib.node. My schema.prisma file includes:

generator client {
  provider       = "prisma-client-js"
  bindaryTargets = ["native", "darwin"]
}

I can't seem to figure out how to generate the right query engine binary with darwin and not darwin-arm64, or have the clientVersion look for the latter.

Here's npx prisma -v:

prisma                  : 3.7.0
@prisma/client          : 3.7.0
Current platform        : darwin-arm64
Query Engine (Node-API) : libquery-engine 8746e055198f517658c08a0c426c7eec87f5a85f (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine        : migration-engine-cli 8746e055198f517658c08a0c426c7eec87f5a85f (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Introspection Engine    : introspection-core 8746e055198f517658c08a0c426c7eec87f5a85f (at node_modules/@prisma/engines/introspection-engine-darwin-arm64)
Format Binary           : prisma-fmt 8746e055198f517658c08a0c426c7eec87f5a85f (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64)
Default Engines Hash    : 8746e055198f517658c08a0c426c7eec87f5a85f
Studio                  : 0.445.0

I'm running on a new M1 iMac. Any help would be so so appreciated, thanks!

like image 550
mcw Avatar asked Feb 26 '26 00:02

mcw


2 Answers

I had bindaryTargets. Should be binaryTargets. LMAO

like image 108
mcw Avatar answered Feb 28 '26 13:02

mcw


For me mac M2, its work with darwin-arm64

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "darwin-arm64"]
}
like image 40
Mrityunjay Kumar Avatar answered Feb 28 '26 13:02

Mrityunjay Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!