I encountered the same error when trying to run my Strapi v3 application with the command npm run develop
. The error indicated that the sharp
module could not find its compiled binary (sharp.node
).
Solution:
- Node.js Version: I was using Node.js 18.20.4, which is not fully compatible with Strapi v3. I downgraded to Node.js 14.x using nvm (Node Version Manager) while npm v10.
- Clean and Reinstall Node Modules:
rm -rf node_modules
npm install
- Rebuild the Sharp Module:
npm rebuild --verbose sharp
- Run Strapi:
npm run develop
After following these steps, my Strapi application started successfully without any errors. I hope this helps anyone facing similar issues!
PS D:\bright-clinic-web\Strapi-bright-clinic\bright-clinic-cms> npm install -g npm@latest
removed 62 packages, and changed 110 packages in 14s
25 packages are looking for funding
run npm fund
for details
PS D:\bright-clinic-web\Strapi-bright-clinic\bright-clinic-cms> npm cache clean -f
npm warn using --force Recommended protections disabled.
PS D:\bright-clinic-web\Strapi-bright-clinic\bright-clinic-cms> pnpm add sharp
Downloading @img/sharp-win32-x64@0.33.5: 8.18 MB/8.18 MB, done
WARN 6 deprecated subdependencies found: boolean@3.2.0, buildmail@3.10.0, glob@7.2.3, inflight@1.0.6, mailcomposer@3.12.0, rimraf@3.0.2
Packages: +1296
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1402, reused 1289, downloaded 3, added 1296, done
node_modules/.pnpm/core-js-pure@3.39.0/node_modules/core-js-pure: Running postinstall script, done in 436ms
node_modules/.pnpm/better-sqlite3@11.3.0/node_modules/better-sqlite3: Running install script…
node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild: Running postinstall script, done in 2.7s
node_modules/.pnpm/esbuild@0.21.3/node_modules/esbuild: Running postinstall script, done in 2.5s
node_modules/.pnpm/sharp@0.33.5/node_modules/sharp: Running install script, done in 3.3s
node_modules/.pnpm/sharp@0.32.6/node_modules/sharp: Running install script, failed in 10.5s
…/sharp@0.32.6/node_modules/sharp install$ (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebu…
│ sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-win32-x64.tar.br
│ sharp: Installation error: Request timed out
│ sharp: Please see sharp - High performance Node.js image processing for required dependencies
└─ Failed in 10.5s at D:\bright-clinic-web\Strapi-bright-clinic\bright-clinic-cms\node_modules.pnpm\sharp@0.32.6\node_modules\sharp
node_modules/.pnpm/esbuild@0.16.17/node_modules/esbuild: Running postinstall script, done in 1.3s
ELIFECYCLE Command failed with exit code 1.
I am a window user I am facing this error while trying to create a Strapi setup
can some one tell me how to solve this issue