我真的不熟悉 docker,但我正在使用 docker 运行一个 web 应用程序,它使用了 Prisma/nexus
当我尝试组合时,出现此错误:
Error: Unknown binaryTarget linux-arm-openssl-undefined and no custom binaries were provided
有人能告诉我这个错误是什么意思,我该如何解决?我认为这与 docker 不支持我正在开发的操作系统有关,但我不完全确定。
最佳答案
来自 the official docs ,
Prisma Client consists of three major components.
- JavaScript client library
- TypeScript type definitions
- A query engine (in the form of binary file)
虽然生成的代码是跨平台的(这是 javascript),但
query engine
不是。当您运行
prisma generate
时命令,prisma 似乎使用 query engine
,但它需要为当前平台找到合适的二进制文件 otherwise it throws an error .问题是由于某种原因我无法解释(因为我有同样的问题)docker 中的平台未被识别为 supported platform one .
我的猜测是 docker 提供了错误的平台,或者在某些时候在 Prisma 中存在错误,错误消息
linux-arm-openssl-undefined
与 undefined
其中可能是问题的线索。解决方案:现在:我计划在 x86 计算机上运行我的图像 解决这个问题的时间。最新的 docker 3 RC2(5 天前发布)也没有帮助。
请注意,您可以在
schema.prisma
中指定 binaryTargets文件。generator client {
provider = "prisma-client-js"
binaryTargets = ["debian-openssl-1.1.x"]
}
但是出于某种原因,即使我在 debian 上构建我的 docker 镜像,这也不起作用。 Prisma 似乎认出我在 linux-arm
但无法将 binaryTarget 关联到。还有……这个平台真的准确吗? docker 是在后台运行 linux arm 还是在 rosetta 下运行 x86 debian?我不知道。[编辑]
节点图像是多架构的,这意味着
FROM node:15.12.0-buster-slim AS builder
将为我的主机平台 (linux/arm64/v8) 选择 linux 架构看来我们实际上可以build for x86 on m1 using buildx experimental feature according to this post
关于docker-compose up 问题使用 Docker Apple M1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66530969/