Build failed during install dependencies

I’m getting this error:

Failed during stage 'Install dependencies': dependency_installation script returned non-zero exit code: 1

Mind you, this project installs all packages, builds and previews on my localhost without issue. How can I tell which package is failing to install?

Is the problem because some package might be installed as a dependency versus devDependency?

My package.json

{
  "name": "@example/blog",
  "type": "module",
  "version": "1.0.2",
  "private": true,
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro build",
    "preview": "astro preview",
    "astro": "astro"
  },
  "dependencies": {
    "@astrojs/image": "^0.16.6",
    "@astrojs/mdx": "^0.19.0",
    "@astrojs/prefetch": "^0.2.1",
    "@astrojs/rss": "^2.4.0",
    "@astrojs/sitemap": "^1.2.2",
    "@csstools/postcss-global-data": "^1.0.3",
    "@fontsource/be-vietnam-pro": "^4.5.8",
    "astro": "2.3.2",
    "astro-compress": "^1.1.42",
    "astro-critters": "^1.1.34",
    "astro-icon": "^0.8.0",
    "autoprefixer": "^10.4.14",
    "media-chrome": "^0.21.0",
    "micromark": "^3.1.0",
    "micromark-extension-gfm": "^2.0.1",
    "micromark-extension-mdxjs": "^1.0.0",
    "open-graph-scraper": "^5.2.3",
    "postcss-import": "^15.1.0",
    "postcss-preset-env": "^8.3.2",
    "query-string": "^8.1.0",
    "sanitize-html": "^2.10.0",
    "sharp": "^0.31.3",
    "slug": "^8.2.2",
    "svgo": "^2.8.0"
  },
  "browserslist": [
    "last 1 safari version",
    "last 2 chrome versions",
    "last 2 firefox versions",
    "> 1% in US"
  ],
  "devDependencies": {
    "@csstools/postcss-oklab-function": "^2.2.1",
    "@types/slug": "^5.0.3",
    "postcss": "^8.4.23",
    "postcss-jit-props": "^1.0.13",
    "prettier-plugin-astro": "^0.8.0"
  }
}

Can you share the link to the full build log as the line you’ve shared doesn’t provide enough relevant information to assist.

This, generallly, should not matter.

The issues seems to be with a sharp 0.32.1 and @astrojs/image plugin. This version of Sharp seems too new as it has an unmet peer dependency.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: astro@2.3.2
npm ERR! Found: sharp@0.32.1
npm ERR! node_modules/sharp
npm ERR!   sharp@"^0.32.1" from the root project
npm ERR!   peerOptional sharp@">=0.31.0" from @astrojs/image@0.16.6
npm ERR!   node_modules/@astrojs/image
npm ERR!     @astrojs/image@"^0.16.6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional sharp@"^0.31.3" from astro@2.3.2
npm ERR! node_modules/astro
npm ERR!   astro@"2.3.2" from the root project
npm ERR!   peer astro@"^2.2.2" from @astrojs/image@0.16.6
npm ERR!   node_modules/@astrojs/image
npm ERR!     @astrojs/image@"^0.16.6" from the root project
npm ERR!   1 more (@astrojs/markdown-remark)
npm ERR! 
npm ERR! Conflicting peer dependency: sharp@0.31.3
npm ERR! node_modules/sharp
npm ERR!   peerOptional sharp@"^0.31.3" from astro@2.3.2
npm ERR!   node_modules/astro
npm ERR!     astro@"2.3.2" from the root project
npm ERR!     peer astro@"^2.2.2" from @astrojs/image@0.16.6
npm ERR!     node_modules/@astrojs/image
npm ERR!       @astrojs/image@"^0.16.6" from the root project
npm ERR!     1 more (@astrojs/markdown-remark)
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

One solution to the issue is outlined in the log itself

You can read more about this here and here

If I add sharp 0.31.0 in my project, VS Code yells at me:

objc[52943]: Class GNotificationCenterDelegate is implemented in both /Volumes/Evo/Sites/mysite/node_modules/astro-compress/node_modules/sharp/vendor/8.14.2/darwin-arm64v8/lib/libvips-cpp.42.dylib (0x11c555938) and /opt/homebrew/Cellar/glib/2.76.0/lib/libgio-2.0.0.dylib (0x111f146b0). One of the two will be used. Which one is undefined.

It looks like there’s a conflict with another plugin, astro-compress, and sharp as well.

And I get:

Waiting for the @astrojs/image integration...
 error   VipsOperation: class "heifsave_buffer" not found

Have you tried the solution offered in my previous response?

Are you able to share the repository you are deploying from?

I don’t think my issue has to do with Netlify. It seems like Sharp version incompatibility issues. Consider this closed.

1 Like