Prisma query engine not found on mac M1
Asked Answered
K

3

11

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!

Katlynkatmai answered 5/1, 2022 at 21:47 Comment(1)
For anyone coming across this in the future, check your node version against the allowed versions for Prisma... (<=v20.x). I ran brew install, which auto updates everything including setting my node version to 21.x and that caused this issue for me.Haircut
K
9

I had bindaryTargets. Should be binaryTargets. LMAO

Katlynkatmai answered 5/1, 2022 at 22:40 Comment(0)
W
2

For me mac M2, its work with darwin-arm64

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "darwin-arm64"]
}
Westberg answered 5/12, 2022 at 13:17 Comment(0)
D
0

I downgraded my node to v14 from v16, which worked for me. I didn't have to set the binaryTarget property.

generator client {
  provider = "prisma-client-js"
}
Dinitrobenzene answered 9/2, 2023 at 22:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.