Using Next.js' built-in Image Optimization requires sharp as a dependency.
You are seeing this error because your OS was unable to install sharp properly, either using pre-built binaries or building from source.
Option 1: Use a different version of Node.js and try to install sharp
again.
npm i sharp
# or
yarn add sharp
Option 2: If using macOS, ensure XCode Build Tools are installed and try to install sharp
again.
For example, see macOS Catalina instructions.
Option 3: Use a different OS and try to install sharp
again.
For example, if you're using Windows, try using WSL (Windows Subsystem for Linux).