Facing error on installation of Strapi . " Something went wrong installing the "sharp" module"

details="System Information

  • **Strapi Version 4.x.x
  • Operating System: windows
  • Database: sqlite
  • Node Version: 16.x.x.
  • NPM Version: 8 .x.x
  • Yarn Version: 1.13.0
    Sharp module is present in node module folder but . it’s throwing error .
    can anyone know what’s the problem.Please help me to solve .i tired many solution but unable to fix it.
    Error :
    [2022-03-08 22:22:50.208] debug: :no_entry: Server wasn’t able to start properly.
    [2022-03-08 22:22:50.210] error: Could not load js config file D:\Mohsin-Work-Space\Gatsby Practice Source Code\yourProjectName\node_modules@strapi\plugin-upload\strapi-server.js:
    Something went wrong installing the “sharp” module

The specified module could not be found.
\?\D:\Mohsin-Work-Space\Gatsby Practice Source Code\yourProjectName\node_modules\sharp\build\Release\sharp-win32-x64.node


getting same issue

have the same issue too.

It might happen if you use a Mac M1. But usually downgrading to node v14 fixes it

This can also happen if your launch.json in VSCode runtimeVersion doesn’t match the version you are using in the CLI that you ran npm install with.

Getting same error:

error C:\Users\nagarsu\Documents\Stripe Test\test21\my-project\node_modules\sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Directory: C:\Users\nagarsu\Documents\Stripe Test\test21\my-project\node_modules\sharp
sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.13.2/libvips-8.13.2-win32-x64.tar.br
sharp: Installation error: unable to get local issuer certificate
sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies

getting same error

Hello everyone :wave:

Sharp is part of the upload module and what is creating images etc when doing it.
This is with node built on the host system. So you the installation process depends on your OS.

  1. Identify your operating system. This guide assumes you’re either running Windows or macOS.

  2. If you’re on Windows, you’ll need to install Build Tools from Microsoft. You can download it from this link: . Follow the prompts to install the necessary components.

  3. If you’re on macOS, you can use brew to install vips. Open the Terminal app and run the command

brew install vips
  1. Once you have the necessary tools installed, make sure you’re running Node 16 or 18. You can check your version by running the command “node -v” in your terminal. If you need to upgrade, you can download the latest version from the official Node.js website: Download | Node.js.

  2. Please make sure you delete the following files after doing this.

  • node_modules
  • build
  • .cache
  • package-lock.json or yarn.lock

Hope this helps. :cake: :partying_face:

@Eventyret where is this documented?

It’s not part of strapi it’s part of NodeJS.
NodeJS even tells about this if you get the error. and highlights the same page that I linked to.

The other part is just experience :slight_smile:

@eventyret the docs doesn’t mention sharp. Or at least the search gives no result for sharp. That is what I meant.

try commands
npm config set strict-ssl false

to shut down tls certificats verification

heh it’s worked for my provider on test account but not for my real enviroment.
i guess, i should go for wordpress solutions))

heh. We went out of RAM. so check your usage of ram also))

I had the same error when I put my Strapi instance inside Docker container. I had to add this line /server/node_modules to the volumes section of docker compose configuration and it worked

It’s very bad practice to share node_modules with a container.
The error is normally because sharp and build tools are not installed.

On Alpine with Node 18 and python3.11, the issue is the dependency on sharp 0.32.0, which depends on prebuild ^11.0.4 which in turns depends on node-gyp ^6.0.1 which is incompatible with newer versions of python.

Sharp 0.32.6 brings prebuild ^12.0.0 and node-gyp ^9.4.0 solving the issue.

Downgrading to python3.10 (Alpine 3.18 → 3.17) did it for me.

On other environments it might be useful as well to drop down to python3.10.

1 Like

I did try all of these steps on my Mac M1, unfortunately the problem persists both on my project I upgraded and a fresh installation.

Do I need to uninstall node completely from my machine and reinstall?

Same issue here - tried putting it in docker and it worked for a few days but now we have the issue in docker too. Here is the docker file:

FROM node:16-alpine

RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev

ARG NODE_ENV=development



COPY package.json ./

RUN yarn config set network-timeout 600000 -g && yarn install

ENV PATH /opt/node_modules/.bin:$PATH

WORKDIR /opt/app

COPY . .

RUN chown -R node:node /opt/app

USER node


CMD [“yarn”, “develop”]

And here is the docker-compose.yaml file:

version: ‘3’
container_name: strapi
build: ./strapi
image: strapi:latest
restart: unless-stopped
env_file: strapi/.env
- ./strapi/config:/opt/app/config
- ./strapi/src:/opt/app/src
- ./strapi/package.json:/opt/package.json
- ./strapi/.env:/opt/app/.env
- ./strapi/public/uploads:/opt/app/public/uploads
- “1337:1337”

What are we doing wrong?

1 Like

Question what operation system is your PC?

Suddenly I’d started to have same issue as well. Just scaled down the replica set to 0 and later scaled up to 1 and that’s it.