From b7daae418bc1f447a786709cc89ab33ec982ce80 Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 30 Oct 2020 10:56:11 -0400 Subject: [PATCH] Update install-sharp.md (#18508) Co-authored-by: Luis Alvarez D. --- errors/install-sharp.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/errors/install-sharp.md b/errors/install-sharp.md index 168d23082c174..5c35f95b7357d 100644 --- a/errors/install-sharp.md +++ b/errors/install-sharp.md @@ -2,13 +2,13 @@ #### Why This Error Occurred -Using Next.js' built-in Image Optimization requires that you install `sharp`. +Using Next.js' built-in [Image Optimization](https://nextjs.org/docs/basic-features/image-optimization) requires [sharp](https://www.npmjs.com/package/sharp) as a dependency. -Since `sharp` is optional, it may have been skipped if you installed `next` with the [`--no-optional`](https://docs.npmjs.com/cli/install) flag or it may have been skipped if your platform does not support `sharp`. +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: Install the `sharp` package in your project. +Option 1: Use a different version of Node.js and try to install `sharp` again. ```bash npm i sharp @@ -16,13 +16,10 @@ npm i sharp yarn add sharp ``` -Option 2: Configure an external loader in `next.config.js` such as [imgix](https://imgix.com). +Option 2: If using macOS, ensure XCode Build Tools are installed and try to install `sharp` again. -```js -module.exports = { - images: { - path: 'https://example.com/myaccount/', - loader: 'imgix', - }, -} -``` +For example, see [macOS Catalina instructions](https://github.com/nodejs/node-gyp/blob/66c0f0446749caa591ad841cd029b6d5b5c8da42/macOS_Catalina.md). + +Option 3: 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).