科尔多瓦Res未安装在离子科尔多瓦中

时间:2019-10-24 10:52:52

标签: android node.js cordova ionic-framework sharp

我无法在ionic 5.4.4v中安装Cordova-res软件包,并在下面收到错误消息

**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

> sharp@0.22.1 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]

不知道与什么错误有关,我认为它不下载libvips或与Sharp相关,然后如何安装Sharp,原因是当我通过npm install安装它时也引发了错误尖锐

  • 我尝试重新安装所有内容,已经安装了nodejs 12.13.0
  • 然后我安装了NVM v1.1.7
  • 然后我安装了离子科尔多瓦
  • 使用离子性开始新项目后
  • 然后我为科尔多瓦准备了项目“离子科尔多瓦准备” ,它显示了以下警告

日志:

**[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

运行npm i -g cordova-res之后,我遇到了错误提示

1 个答案:

答案 0 :(得分:0)

我设法按照以下步骤进行安装:

以root身份登录:

su

然后安装,但使用--unsafe-perm标志:

npm i -g cordova-res --unsafe-perm