Ionic 4: Ionic cordova resources fails with node error

I’ve used NVM to install my Ionic 4 environment.

Trying to run:

ionic cordova resources

getting the error:

Davids-MacBook-Pro:synergyzed-app daveshirman$ ionic cordova resources
> cordova-res
[cordova-res] Something went wrong installing the "sharp" module
[cordova-res] The module '/usr/local/lib/node_modules/cordova-res/node_modules/sharp/build/Release/sharp.node'
[cordova-res] was compiled against a different Node.js version using
[cordova-res] NODE_MODULE_VERSION 57. This version of Node.js requires
[cordova-res] NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
[cordova-res] the module (for instance, using `npm rebuild` or `npm install`).
[cordova-res] - Ensure the version of Node.js used at install time matches that used at runtime
[cordova-res] - Consult the installation documentation at
[cordova-res] - Search for this error at
[ERROR] An error occurred while running subprocess cordova-res.

Q) How to I fix this so that I can generate my resources? Is this the cordova install on my machine that’s busted?



npm remove cordova-res
npm install cordova-res

Thanks for keeping this up! Worked for me :bowing_man:

I am still getting the error also showing permission denied even i used sudo, i am using mac

1 Like

Maybe this will help - but set the permissions for your Ionic project root?

Please try this for iOS, may be help you alot

sudo npm uninstall cordova-res && sudo npm install -g cordova-res --unsafe-perm=true