【问题标题】:sharp installation failed (npm) while installing cordova-res and sharp packages in linux在linux中安装cordova-res和sharp包时,sharp安装失败(npm)
【发布时间】:2020-11-15 06:54:05
【问题描述】:

我已经在 ubuntu 20.04 和 debian buster 中安装了 node 和 npm 最新版本。 我已经从 linux 中的 apt 安装了 libvips 和 glib 包包


/usr/include/vips/vips8:35:10: fatal error: glib-object.h: No such file or directory
 #include <glib-object.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
make: *** [sharp.target.mk:129: Release/obj.target/sharp/src/common.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/cordova-res/node_modules/sharp/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.4.0-42-lowlatency
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/cordova-res/node_modules/sharp
gyp ERR! node -v v10.21.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.25.4 install: `(node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sharp@0.25.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-07-25T14_48_56_334Z-debug.log

如果有人知道请回答。如何将 glib-object.h 添加到 vips 目录?

【问题讨论】:

    标签: android linux ionic-framework npm sharp


    【解决方案1】:

    现在通过更改所需版本(支持的旧 nodejs 版本)来修复它。使用 nvm,您可以轻松地在版本之间切换,而无需卸载当前版本。 节点中的许多包,不支持最新(最新)版本。因此,您必须改用旧版本。 即使它无法通过包管理器 (npm) 安装 prebuild

    【讨论】:

      【解决方案2】:
      1. brew install pkg-config

      2. 现在你需要从源代码安装 libvips

      3. https://github.com/libvips/libvips/releases下载并解压最新版本

      4. cd 到解压的文件夹

      5. ./配置

      6. 制作

      7. sudo 安装

      8. npm i -g cordova-res

      【讨论】:

        猜你喜欢
        • 2020-02-11
        • 2018-03-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-08-06
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多