跳转到内容

Could not find Sharp.

MissingSharp: 找不到 Sharp. 请手动安装 Sharp(sharp)到你的项目或迁移到另外一个图片服务。

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

如果你不使用 astro:assets 来处理图片,也不想安装 Sharp,你可以配置以下不处理图片的服务:

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

请参阅: