Skip to content

找不到 Sharp。

MissingSharp:找不到 Sharp。请手动将 Sharp (sharp) 安装到你的项目中或迁移到其他图片服务。

¥MissingSharp: Could not find Sharp. Please install Sharp (sharp) manually into your project or migrate to another image service.

¥What went wrong?

Sharp 是 astro:assets 使用的默认图片服务。当使用 严格的包管理器(如 pnpm)时,必须手动将 Sharp 安装到项目中才能使用图片处理。

¥Sharp is the default image service used for astro:assets. When using a strict package manager like pnpm, Sharp must be installed manually into your project in order to use image processing.

如果你不使用 astro:assets 进行图片处理,并且不想安装 Sharp,你可以配置以下不进行处理的直通图片服务:

¥If you are not using astro:assets for image processing, and do not wish to install Sharp, you can configure the following passthrough image service that does no processing:

import { defineConfig, passthroughImageService } from "astro/config";
export default defineConfig({
image: {
service: passthroughImageService(),
},
});

也可以看看:

¥See Also:

Astro 中文网 - 粤ICP备13048890号