Having issues install either cordova-res or capacitor-assets using npm or yarn

currently having to create a different splash and icon assets for the capacitor application i am working on, but everytime i try to install either cordova-res or capacitor-assests using either npm or yarn the sharp dependency used in the package would always return an error which would make the package not to be installed in my device.
Error message
npm error code 1
npm error path C:\Users\Shopinverse\Desktop\website designs\capacitor-applications\sabar-ecommerce\node_modules\sharp
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm error sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.11.3/libvips-8.11.3-win32-x64.tar.br
npm error sharp: Please see sharp - High performance Node.js image processing for required dependencies
npm error sharp: Installation error: Request timed out
npm error A complete log of this run can be found in: C:\Users\Shopinverse\AppData\Local\npm-cache_logs\2024-08-07T09_24_24_065Z-debug-0.log

Package been used and their versions
@capacitor/android”: “^6.1.1”,
@capacitor/cli”: “^6.1.1”,
@capacitor/core”: “^6.1.1”,
@ionic/react”: “^8.2.6”,
using windows 10 64bit pc.
thanks for any assistance, suggestion or solution been given.

I just tried and it is working just fine :sweat_smile:

npm install --save-dev @capacitor/assets

What version of Node are you running? Sharp requires the following:

Node-API v9 compatible runtime e.g. Node.js ^18.17.0 or >=20.3.0.

i am making use of v20.14.0

just tried the npm command above and still got this error e excellent to each other.
npm warn deprecated
npm warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp)
npm error code 1
npm error path C:\Users\Shopinverse\Desktop\website designs\capacitor-applications\sabar-ecommerce\node_modules\sharp
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm error sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-win32-x64.tar.br
npm error sharp: Please see sharp - High performance Node.js image processing for required dependencies
npm error sharp: Installation error: Request timed out
npm error A complete log of this run can be found in: C:\Users\Shopinverse\AppData\Local\npm-cache_logs\2024-08-07T16_02_22_026Z-debug-0.log

here is a snippet of my log
1441 silly packumentCache corgi:https://registry.npmjs.org/semver cache-miss

1442 http fetch GET 200 https://registry.npmjs.org/debug/-/debug-4.3.4.tgz 17429ms (cache miss)

1443 warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported

1444 http fetch GET 200 https://registry.npmjs.org/semver 16207ms (cache revalidated)

1445 silly packumentCache corgi:https://registry.npmjs.org/semver set size:92294 disposed:false

1446 silly packumentCache corgi:https://registry.npmjs.org/simple-update-notifier cache-miss

1447 warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

1448 warn deprecated q@1.5.1: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.

1448 warn deprecated

1448 warn deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp)

1449 http fetch GET 200 https://registry.npmjs.org/simple-update-notifier 20949ms (cache revalidated)

1450 silly packumentCache corgi:https://registry.npmjs.org/simple-update-notifier set size:21489 disposed:false

1451 silly packumentCache corgi:https://registry.npmjs.org/nodemon cache-miss

1452 http fetch GET 200 https://registry.npmjs.org/nodemon 17494ms (cache revalidated)

1453 silly packumentCache corgi:https://registry.npmjs.org/nodemon set size:269344 disposed:false

1454 silly packumentCache corgi:https://registry.npmjs.org/npm-watch cache-miss

1455 http fetch GET 200 https://registry.npmjs.org/npm-watch 1480ms (cache revalidated)

1456 silly packumentCache corgi:https://registry.npmjs.org/npm-watch set size:24697 disposed:false

1457 info run sharp@0.32.6 install node_modules/sharp (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

1458 info run sharp@0.32.6 install { code: 1, signal: null }

1459 verbose stack Error: command failed

1459 verbose stack at promiseSpawn (C:\Users\Shopinverse\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\promise-spawn\lib\index.js:22:22)

1459 verbose stack at spawnWithShell (C:\Users\Shopinverse\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\promise-spawn\lib\index.js:124:10)

1459 verbose stack at promiseSpawn (C:\Users\Shopinverse\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\promise-spawn\lib\index.js:12:12)

1459 verbose stack at runScriptPkg (C:\Users\Shopinverse\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\run-script\lib\run-script-pkg.js:77:13)

1459 verbose stack at runScript (C:\Users\Shopinverse\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\run-script\lib\run-script.js:9:12)

1459 verbose stack at C:\Users\Shopinverse\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\rebuild.js:329:17

1459 verbose stack at run (C:\Users\Shopinverse\AppData\Roaming\npm\node_modules\npm\node_modules\promise-call-limit\dist\commonjs\index.js:67:22)

1459 verbose stack at C:\Users\Shopinverse\AppData\Roaming\npm\node_modules\npm\node_modules\promise-call-limit\dist\commonjs\index.js:84:9

1459 verbose stack at new Promise ()

1459 verbose stack at callLimit (C:\Users\Shopinverse\AppData\Roaming\npm\node_modules\npm\node_modules\promise-call-limit\dist\commonjs\index.js:35:69)

1460 verbose pkgid sharp@0.32.6

1461 error code 1

1462 error path C:\Users\Shopinverse\Desktop\website designs\capacitor-applications\sabar-ecommerce\node_modules\sharp

1463 error command failed

1464 error command C:\WINDOWS\system32\cmd.exe /d /s /c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

1465 error sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-win32-x64.tar.br

1465 error sharp: Please see sharp - High performance Node.js image processing for required dependencies

1466 error sharp: Installation error: Request timed out

1467 silly unfinished npm timer reify 1723046544574

1468 silly unfinished npm timer reify:build 1723046814863

1469 silly unfinished npm timer build 1723046814867

1470 silly unfinished npm timer build:deps 1723046814868

1471 silly unfinished npm timer build:run:install 1723046815712

1472 silly unfinished npm timer build:run:install:node_modules/sharp 1723046815713

1473 verbose cwd C:\Users\Shopinverse\Desktop\website designs\capacitor-applications\sabar-ecommerce

1474 verbose os Windows_NT 10.0.19045

1475 verbose node v20.14.0

1476 verbose npm v10.8.2

1477 verbose exit 1

1478 verbose code 1

1479 error A complete log of this run can be found in: C:\Users\Shopinverse\AppData\Local\npm-cache_logs\2024-08-07T16_02_22_026Z-debug-0.log. please i need help figuring out how to fix this issue, thanks

The libvips-8.14.5-win32-x64.tar.br binary is 7.7 MB. Where are you located? Can you download it by following the URL directly? How long does it take?

fetch-timeout default is 5 minutes.

is it possible to download it locally and utilizing it within the node_module folder or can i increase npm timeout to about 10minutes to fix the problem. and i stay in Nigeria in africa

You can increase the timeout by running the following:

# Set
npm config set fetch-timeout=600000 # 10 minutes

# Get
npm config get fetch-timeout

tried to install the @capacitor/assets package again using npm after increasing the timeout for npm but still getting the same error as i specified above. i have even tried to install sharp as a different package to ensure that its available within my package.json file and node_module. but it still doesnt enable the installation of capacitor/assets package. was checking the links been provided as a feedback from the error to ensure that i can read the documentation properly and ensure that i am working correctly
and i saw that i am doing it correctly. what else could be the possible cause again

i have fixed the issue with the installation of @capacitor/assets. the issue occurred due to my poor network. thanks for the assistance

1 Like