Files
vercel__next.js/errors/install-sharp.mdx
Delba de Oliveira 3bf570d84d Docs IA 2.0: Images (#78769)
Closes:
- https://linear.app/vercel/issue/DOC-4626/images
- https://linear.app/vercel/issue/DOC-4610/split-image-and-font-pages

Redirects: https://github.com/vercel/next.js/pull/78769

**Housekeeping:** 
- Deletes BYA images page
- Creates relevant getting started docs in `/pages`
- Splits "Images and Fonts" into "Images" and "Fonts" pages to allow us
to add more context to each page in the future

**API reference**: 
- Improves image API reference to follow more of a consistent format and
language
- Adds examples

**Follow-up:** https://github.com/vercel/next.js/pull/78857
- Create a Deep Dive Guide on how image optimization works

---------

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2025-05-08 13:11:38 +01:00

40 lines
1.3 KiB
Plaintext

---
title: 'Install `sharp` to Use Built-In Image Optimization'
---
## Why This Error Occurred
Using Next.js' built-in [Image Optimization](/docs/pages/api-reference/components/image) requires [sharp](https://www.npmjs.com/package/sharp) as a dependency.
You are seeing this error because your OS was unable to [install sharp](https://sharp.pixelplumbing.com/install) properly, either using pre-built binaries or building from source.
## Possible Ways to Fix It
Option 1: Use a different version of Node.js and try to install `sharp` again.
```bash filename="Terminal"
npm i sharp
```
```bash filename="Terminal"
yarn add sharp
```
```bash filename="Terminal"
pnpm add sharp
```
```bash filename="Terminal"
bun add sharp
```
Option 2: Try installing the wasm variant of `sharp` by running `npm install --cpu=wasm32 sharp`.
Option 3: If using macOS, ensure XCode Build Tools are installed and try to install `sharp` again.
For example, see [macOS Catalina instructions](https://github.com/nodejs/node-gyp/blob/66c0f0446749caa591ad841cd029b6d5b5c8da42/macOS_Catalina.md).
Option 4: Use a different OS and try to install `sharp` again.
For example, if you're using Windows, try using [WSL](https://docs.microsoft.com/en-us/windows/wsl/about) (Windows Subsystem for Linux).