Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova-res not installing in ionic cordova

I am not able to install package Cordova-res in ionic 5.4.4v and getting the error below

**Z:\my program V2\ionicTest\testProj>npm i -g cordova-res**

C:\Users\USER\AppData\Roaming\npm\cordova-res -> C:\Users\USER\AppData\Roaming\npm\node_modules\cordova-res\bin\cordova-res

> [email protected] install C:\Users\USER\AppData\Roaming\npm\node_modules\cordova-res\node_modules\sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.4/libvips-8.7.4-win32-x64.tar.gz
C:\Users\USER\AppData\Roaming\npm\node_modules\cordova-res\node_modules\sharp\install\libvips.js:83
          throw err;
          ^

##Error: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80##
    at ClientRequest.onError (C:\Users\USER\AppData\Roaming\npm\node_modules\cordova-res\node_modules\tunnel-agent\index.js:177:17)
    at Object.onceWrapper (events.js:300:26)
    at ClientRequest.emit (events.js:210:5)
    at Socket.socketErrorListener (_http_client.js:406:9)
    at Socket.emit (events.js:210:5)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) 
{
  code: 'ECONNRESET'
}

C:\Users\USER\AppData\Roaming\npm\node_modules\cordova-res\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Users\USER\AppData\Roaming\nvm\v12.13.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\USER\AppData\Roaming\nvm\v12.13.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.

*  VError.cpp
*  VInterpolate.cpp
*  VImage.cpp
*  win_delay_load_hook.cc

c:\users\user\appdata\roaming\npm\node_modules\cordova-res\node_modules\sharp\src\libvips\cplusplus\verror.cpp(33): fatal error C1083: Cannot open include file: 'vips/intl.h': No such file or directory [C:\Users\USER\AppData\Roam
ing\npm\node_modules\cordova-res\node_modules\sharp\build\libvips-cpp.vcxproj]

c:\users\user\appdata\roaming\npm\node_modules\cordova-res\node_modules\sharp\src\libvips\cplusplus\vimage.cpp(41): fatal error C1083: Cannot open include file: 'vips/intl.h': No such file or directory [C:\Users\USER\AppData\Roam
ing\npm\node_modules\cordova-res\node_modules\sharp\build\libvips-cpp.vcxproj]

c:\users\user\appdata\roaming\npm\node_modules\cordova-res\node_modules\sharp\src\libvips\cplusplus\vinterpolate.cpp(34): fatal error C1083: Cannot open include file: 'vips/intl.h': No such file or directory [C:\Users\USER\AppDat
a\Roaming\npm\node_modules\cordova-res\node_modules\sharp\build\libvips-cpp.vcxproj]

Don't know what error is related to, I think it is not downloading libvips or is it related to sharp, then how to install sharp cause it is also throwing an error when I am installing it via npm install sharp

  • I have tried reinstalling everything, I have installed nodejs 12.13.0
  • Then I installed NVM v1.1.7
  • Then I installed ionic Cordova
  • After I started a new project using ionic
  • Then I prepared project for Cordova "ionic cordova prepare", it showed following warning

Log:

**[WARN] No platforms added to this project. Cannot prepare native platforms without any installed.**

* Then I added platform via **"ionic cordova platform add android"**, and it showed the following warning:

[WARN] cordova-res was not found on your PATH. Please install it globally:

       npm i -g cordova-res

[WARN] Cannot generate resources without cordova-res installed.

       Once installed, you can generate resources with the following command:

       ionic cordova resources android --force

And after running npm i -g cordova-res, I am getting above error

like image 563
Pritish kumar Avatar asked Oct 24 '19 10:10

Pritish kumar


1 Answers

I managed to install it doing the following:

Log as root:

su

Then install but use --unsafe-perm flag:

npm i -g cordova-res --unsafe-perm
like image 190
Blasco Avatar answered Oct 20 '22 23:10

Blasco