Skip to content

Cannot run npm install on Mac due to sharp dependency #3255

@richardm

Description

@richardm

What version of starlight are you using?

34.3

What version of astro are you using?

5.6.1

What package manager are you using?

npm

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

Expected: I should be able to create a new project, run npm install, and then run npm run dev without errors.
Actual: Running npm install on a fresh project fails due to the sharp dependency.

Steps to reproduce:

  1. npm create astro@latest -- --template starlight
  2. cd into the new directory
  3. npm install

Output:

npm ERR! code 1
npm ERR! path ~/code/newproject.com/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-darwin-arm64v8.tar.br
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error:

npm ERR! A complete log of this run can be found in: ~/.npm/_logs/2025-06-24T23_39_50_529Z-debug-0.log

After a bit of research, I was able to overcome this by first running npm install sharp@0.34.2 --save, and then I was able to successfully run npm install and npm run dev.

Link to Minimal Reproducible Example

See notes above.

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions