sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Cannot install sharp on FreeBSD 14.3 (Node 24, npm 11) – runtime not supported

Open vincent7128 opened this issue 1 year ago • 3 comments

Hi sharp team,

I'm trying to use sharp on FreeBSD 14.3 with Node.js 24.7.0 and npm 11.5.1, but the installation fails because the prebuilt binaries do not support FreeBSD. I have libvips installed (v8.17.1) via pkg.

My test project includes the following files:

package.json

{
  "name": "sharp-test",
  "version": "1.0.0",
  "description": "",
  "main": "test.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "module",
  "dependencies": {
    "sharp": "^0.34.3"
  }
}

test.js

import sharp from "sharp";

sharp({
  create: {
    width: 100,
    height: 100,
    channels: 3,
    background: { r: 255, g: 0, b: 0 }
  }
})
.png()
.toFile("out.png")
.then(() => console.log("Sharp works! out.png"))
.catch(err => console.error("Sharp Error:", err));

Environment:

  • OS: FreeBSD 14.3-RELEASE
  • Node: v24.7.0
  • npm: 11.5.1
  • pkg-config vips-cpp version: 8.17.1
  • ABI used for sharp: freebsd-x64

Commands used to check environment:

$ pkg-config --modversion vips-cpp
8.17.1

Error when running node test.js:

Error: Could not load the "sharp" module using the freebsd-x64 runtime
Possible solutions:
- Manually install libvips >= 8.17.1

Reference: Official sharp FreeBSD installation guide: https://sharp.pixelplumbing.com/install/#freebsd

vincent7128 avatar Sep 13 '25 11:09 vincent7128

Did you see https://sharp.pixelplumbing.com/install/#building-from-source?

lovell avatar Sep 13 '25 12:09 lovell

Thanks @lovell 🙏 I followed the link you shared (https://sharp.pixelplumbing.com/install/#building-from-source), very helpful!

vincent7128 avatar Sep 13 '25 13:09 vincent7128

I've attempted to improve the docs relating to this via commit https://github.com/lovell/sharp/commit/6d4d44e2fa8a2924645ce681d5740e3e910e9311

lovell avatar Sep 13 '25 16:09 lovell