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

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.

I’d set NODE_TLS_REJECT_UNAUTHORIZED to bypass that. I might expect that something gets borked when I do strapi start

Mac Mini M1

If it broks someting it is image upload that is the only thing sharp is used for.

Ye is an issue with sharp and spesific Macs where under M1’s

Give it a shot starting from node:16-alpine3.17

That didn’t fix it unfortunately :frowning:

Can you try installing sharp with this for me?

Strange. I used your steps and it worked for me on alpine 3.17.

Once you have done apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev can you type in python3 --version and give the output?

Then when you have done yarn config set network-timeout 600000 -g && yarn install can you go into /opt/app/node_modules/sharp, run yarn install and provide the output?

@ Eventyret I am still getting a dependency timeout error when I attempt to install Strapi. I followed the instructions to install vips and downgrade node and I am still not having any luck.
Environment: Mac OSX Venture, VS Code, Brew/Node
Error:
npx create-strapi-app@latest strapi_cmlcol
? Choose your installation type Quickstart (recommended)
Creating a quickstart project.
Creating a new Strapi application at /Users/Desktop/cml_col/strapi_cmlcol.
Creating files.
Error while installing dependencies:
npm WARN config production Use --omit=dev instead.
npm WARN config optional Use --omit=optional to exclude optional dependencies, or
npm WARN config --include=optional to include them.
npm WARN config
npm WARN config Default value does install optional deps unless otherwise omitted.
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! request to https://codeload.github.com/strapi/ts-zen/tar.gz/66e02232f5997674cc7032ea3ee59d9864863732 failed, reason: undefined

npm ERR! A complete log of this run can be found in: /Users/.npm/_logs/2023-10-02T20_55_42_161Z-debug-0.log
TypeError: Cannot read properties of undefined (reading ‘addBreadcrumb’)
at /Users/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/utils/usage.js:67:28
at Array.forEach ()
at captureStderr (/Users/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/utils/usage.js:66:14)
at createProject (/Users/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/create-project.js:136:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async createQuickStartProject (/Users/.npm/_npx/2d56dd13733e9da7/node_modules/@strapi/generate-new/dist/create-quickstart-project.js:21:5)

I just thought I’d mention what worked for me in case it helps anyone else.

In my case I didn’t have a .dockerignore configured correctly to exclude node_modules. This caused the container to try to use binaries that were built for the host platform. This isn’t the way.

I did have a .dockerignore file, but it was one level up in my docker-compose folder. It needed to be in the docker build context… i.e the folder with your Dockerfile in it.

I share my shame so others may learn :joy:

Just in case it’s useful to anyone. Using alpine 3.17 fixed the issue for me.

I’m still curious because I would like to upgrade alpine later so probably I’ll have to play around with sharp version instead as mentioned in this post: Facing error on installation of Strapi . " Something went wrong installing the "sharp" module" - #17 by Tom

2 Likes

And for me, i didn’t pin my dev versions. won’t be making that mistake again!

1 Like

@jac1013 and @heavyengineer for the updates.

I have the same problem, I want to make an image with docker and I get the same problem, I want to use Pupperter and I install dependencies, but when I run I get the error
debug: :no_entry: Server wasn’t able to start properly.
2024-01-08 09:40:03 [2024-01-08 15:40:03.167] error: Could not load js config file /opt/app/node_modules/@strapi/plugin-upload/strapi-server.js:
2024-01-08 09:40:03 Something went wrong installing the “sharp” module

FROM node:16

Installing libvips-dev for sharp Compatibility

RUN apt-get update && apt-get install libvips-dev -y
RUN apt install -y gconf-service libgbm-dev libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certifica tes fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}

Install Google Chrome Stable and fonts

Note: this installs the necessary libs to make the browser work with Puppeteer.

RUN apt-get update && apt-get install gnupg wget -y &&
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg &&
sh -c ‘echo “deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main” >> /etc/apt/sources.list.d/google.list’ &&
apt-get update &&
apt-get install google-chrome-stable -y --no-install-recommends &&
rm -rf /var/lib/apt/lists/*

WORKDIR /opt/
COPY package.json package-lock.json ./
RUN npm install -g node-gyp
RUN npm config set fetch-retry-maxtimeout 600000 -g && npm install
RUN npm install --ignore-scripts=false --foreground-scripts --verbose sharp
RUN npm install --platform=linux --arch=x64 sharp
RUN npm cache clean -f
RUN npm i --verbose sharp@latest
ENV PATH /opt/node_modules/.bin:$PATH

WORKDIR /opt/app
COPY ./ .

RUN npm run build
EXPOSE 3001
CMD [“npm”, “run”, “develop”]

can you give me a correction

If you are using docker etc you might want to consider use something like puppeteer core etc instead of puppeteer.

It’s Jan 16, 2024 and I ran into all the same issues. npm run develop and npm run start both fail silently without error. This is a really bad developer user experience and should definitely be documented. I also posted another issue related to communications on Strapi 3 install and node versions, verse Strapi 4 installation. IMHO…this is a mess, especially for such an awesome project/product.

I just ran in the same issue while trying to add sharp 0.33.2 to a custom plugin. This SO question hinted that downgrading sharp to 0.32.6 solves the issue, which it did in my case.

Still, not a long term solution.

I did try everything that was suggested (forcing os at install, deleting package-lock, etc) without any success.

I had an issue with Macbook M1 and sharp, here was my workaround so I can use node 18 and a recent strapi (in case pple still searching)

Even two years later the issue persists.
What I already tried:

[2024-04-19 22:42:41.193] debug: ⛔️ Server wasn't able to start properly.
[2024-04-19 22:42:41.195] error: Could not load js config file C:\Users\username\Repositories\strapi-project\node_modules\@strapi\plugin-upload\strapi-server.js:
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-win32-x64.node'

OS version: Win 10
Node version: 20.12.2
NPM version: 10.5.2

Any help appreciated!