Can anybody help me? I'm Not able to install Strapi due to sharp issue

System Information
  • Strapi Version: 4.6.1
  • Operating System: Windows 10
  • Database: SQLlite
  • Node Version: 18.13.0
  • NPM Version: 8.19.3
  • Yarn Version: 1.22.19

Hi, I tried to create project. My yarn installation failed all this because of Sharp getting error.

`> my-project@0.1.0 start
> strapi start

[2023-02-20 23:25:19.279] debug: ⛔️ Server wasn't able to start properly.
[2023-02-20 23:25:19.281] error: Could not load js config file C:\Users\MyUserName\Documents\Stripe Test\test7\my-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'
Require stack:
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\node_modules\sharp\lib\sharp.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\node_modules\sharp\lib\constructor.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\node_modules\sharp\lib\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\server\services\image-manipulation.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\server\services\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\server\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\strapi-server.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\utils\lib\import-default.js
- C:\Users\nagMyUserNamearsu\Documents\Stripe Test\test7\my-project\node_modules\@strapi\utils\lib\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\Strapi.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\commands\transfer\utils.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\bin\strapi.js

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current win32-x64 runtime: "npm install --platform=win32 --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
Error: Could not load js config file C:\Users\MyUserName\Documents\Stripe Test\test7\my-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'
Require stack:
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\node_modules\sharp\lib\sharp.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\node_modules\sharp\lib\constructor.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\node_modules\sharp\lib\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\server\services\image-manipulation.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\server\services\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\server\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\plugin-upload\strapi-server.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\utils\lib\import-default.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\utils\lib\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\Strapi.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\index.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\commands\transfer\utils.js
- C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\bin\strapi.js

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current win32-x64 runtime: "npm install --platform=win32 --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
    at loadJsFile (C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\core\app-configuration\load-config-file.js:18:11)
    at loadFile (C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\core\app-configuration\load-config-file.js:35:14)
    at Object.loadPlugins (C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\core\loaders\plugins\index.js:103:26)
    at async Strapi.loadPlugins (C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\Strapi.js:341:5)
    at async Promise.all (index 2)
    at async Strapi.register (C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\Strapi.js:377:5)
    at async Strapi.load (C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\Strapi.js:487:5)
    at async Strapi.start (C:\Users\MyUserName\Documents\Stripe Test\test7\my-project\node_modules\@strapi\strapi\lib\Strapi.js:217:9)`


error C:\Users\MyUserName\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)
Arguments:
Directory: C:\Users\MyUserName\Documents\Stripe Test\test21\my-project\node_modules\sharp
Output:
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

Make sure you install build tools.

sorry but can you give a little more info. whats does it meen install build tools.
i also have such error. i made as console log suggect
npm install --ignore-scripts=false --foreground-scripts --verbose sharp

but still couldn’t install sharp

npm info run sharp@0.32.1 install { code: 1, signal: null }
npm verb stack Error: command failed
npm verb stack at ChildProcess. (/opt/alt/alt-nodejs18/root/usr/lib/node_modules/npm/node_modules.bundled/@npmcli/promise-spawn/lib/index.js:53:27)
npm verb stack at ChildProcess.emit (node:events:513:28)
npm verb stack at maybeClose (node:internal/child_process:1091:16)
npm verb stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb pkgid sharp@0.32.1

Cannot find module ‘…/build/Release/sharp-linux-x64.node’

Just like i said visit the link if you are on windows and install the build tools.
Build tools is part of Node (as it suggests to install it when you install node for the first time)
But if that checkbox is not set you need to manually install it.
Once done restart it.
You also then need to remove node_modules and then yarn install or npm install again after it has been added.

Without build tools, node-gyp which is part of node will not install which is a requirement for sharp. As it builds this on the host machine.

Different OS has different build tools so without knowing what system you are using I can’t elaborate any more.

it’s problem occurs on my hosting provider environment.
problem with linux server like here

i tried as comments suggest delete cache and node_modules. but problem remains.

also found this Facing error on installation of Strapi . " Something went wrong installing the "sharp" module" - #8 by anjali_jadhav i will one more time and then will contact hosting provider

@demeshko.egor were you able to fix your issue?