Description:
i'm use ionic cordova resources ios --force command
if ionic-cli 5.0.2 will be error Something went wrong installing the "sharp" module
but ionic-cli 4.12.0 is ok
Steps to Reproduce:
Output:
D:\WEB\ConsentApp>ionic cordova resources ios --force
cordova-res.cmd ios
[cordova-res]
[cordova-res] Something went wrong installing the "sharp" module
[cordova-res]
[cordova-res] The specified module could not be found.
[cordova-res] \?\D:\WEB\ConsentAppnode_modulessharp\build\Releasesharp.node
[cordova-res]
[cordova-res] - Remove the "node_modules/sharp" directory, run "npm install" and look for errors
[cordova-res] - Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/
[cordova-res] - Search for this error at https://github.com/lovell/sharp/issues
[cordova-res]
[ERROR] An error occurred while running subprocess cordova-res.
cordova-res.cmd ios exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
My ionic info:
<paste here>
Other Information:
This isn't really a bug in Ionic CLI. You'll have to fix the installation of sharp, which is the image processing dependency of cordova-res. I noticed you have the tool installed in your project, which isn't our recommended strategy.
Install it globally:
npm uninstall cordova-resnpm install -g cordova-resHere are some more things you can try (keep in mind you will need the -g flag in npm for working with global installations):
npm uninstall cordova-res (making sure that the node_modules/sharp directory is removed) and then npm install cordova-res Also, you can pass the --no-cordova-res flag to use the old method (remote resource generation).
sudo npm uninstall cordova-res && sudo npm install -g cordova-res --unsafe-perm=true
its work thankxx brother
sudo npm install -g cordova-res --unsafe-perm=true
I had sharp installed locally too, so did both uninstall and uninstall -g on both cordova-res and sharp
Then install -g cordova-res with --unsafe-perm (and that pulled in sharp) => Bob's my uncle
For Apple M1 sudo npm uninstall -g cordova-res then brew install vips and finally sudo npm install -g cordova-res --unsafe-perm=true
@Florian-crg how you avoid this error once executing ionic cordova resources?
> cordova-res
[cordova-res] /opt/homebrew/lib/node_modules/cordova-res/node_modules/sharp/lib/constructor.js:34
[cordova-res] throw new Error(error);
[cordova-res] ^
[cordova-res]
[cordova-res] Error:
[cordova-res] Something went wrong installing the "sharp" module
[cordova-res]
[cordova-res] dlopen(/opt/homebrew/lib/node_modules/cordova-res/node_modules/sharp/build/Release/sharp.node, 1): Symbol not found: __ZTVN4vips7VOptionE
[cordova-res] Referenced from: /opt/homebrew/lib/node_modules/cordova-res/node_modules/sharp/build/Release/sharp.node
[cordova-res] Expected in: flat namespace
[cordova-res] in /opt/homebrew/lib/node_modules/cordova-res/node_modules/sharp/build/Release/sharp.node
[cordova-res]
[cordova-res] - Remove the "node_modules/sharp" directory then run
[cordova-res] "npm install --ignore-scripts=false --verbose" and look for errors
[cordova-res] - Consult the installation documentation at https://sharp.pixelplumbing.com/install
[cordova-res] - Search for this error at https://github.com/lovell/sharp/issues
[cordova-res]
[cordova-res] at Object.<anonymous> (/opt/homebrew/lib/node_modules/cordova-res/node_modules/sharp/lib/constructor.js:34:9)
[cordova-res] at Module._compile (internal/modules/cjs/loader.js:1063:30)
[cordova-res] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
[cordova-res] at Module.load (internal/modules/cjs/loader.js:928:32)
[cordova-res] at Function.Module._load (internal/modules/cjs/loader.js:769:14)
[cordova-res] at Module.require (internal/modules/cjs/loader.js:952:19)
[cordova-res] at require (internal/modules/cjs/helpers.js:88:18)
[cordova-res] at Object.<anonymous> (/opt/homebrew/lib/node_modules/cordova-res/node_modules/sharp/lib/index.js:3:15)
[cordova-res] at Module._compile (internal/modules/cjs/loader.js:1063:30)
[cordova-res] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
Because i did all that steps and is not working still
Most helpful comment
This isn't really a bug in Ionic CLI. You'll have to fix the installation of sharp, which is the image processing dependency of
cordova-res. I noticed you have the tool installed in your project, which isn't our recommended strategy.Install it globally:
npm uninstall cordova-resnpm install -g cordova-resHere are some more things you can try (keep in mind you will need the
-gflag in npm for working with global installations):npm uninstall cordova-res(making sure that thenode_modules/sharpdirectory is removed) and thennpm install cordova-resAlso, you can pass the
--no-cordova-resflag to use the old method (remote resource generation).