【问题标题】:Vendor File not found during node-gyp build在 node-gyp 构建期间找不到供应商文件
【发布时间】:2021-12-20 22:45:00
【问题描述】:

我愿意在heroku 上安装libvipssharp 的自定义版本。我使用运行没有错误的buildpacks,但是当涉及到node-gyp 编译时,它失败了here,说它无法访问/app/vendor/vips/lib/libvips-cpp.so。当我在不安装sharp的情况下运行构建然后连接heroku run bash,我可以看到文件在这个位置。

为什么 node-gyp 找不到呢?

我的构建包

=== my-site Buildpack URLs
1. heroku-community/apt
2. https://github.com/lechinoix/heroku-buildpack-vips
3. heroku/nodejs

错误

remote: -----> vips (heroku-20 stack) app detected
remote: -----> Vendoring binaries
remote:        Fetching /tmp/codon/tmp/buildpacks/2ef659928923e1b5ae4bf85b886e53d084c6a3d4/build/heroku-20.tar.gz
remote: Changing permissions on libvips folder
remote: -----> Configuring build environment
remote: -----> Building runtime environment
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=false
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 14.x...
remote:        Downloading and installing node 14.18.1...
remote:        Using default npm version: 6.14.15
remote:
remote: -----> Restoring cache
remote:        Caching has been disabled because NODE_MODULES_CACHE=false
remote:
remote: -----> Installing dependencies
remote:        Installing node modules (package.json)
remote:
remote:        > sharp@0.28.1 install /tmp/build_1f4c5c03/node_modules/sharp
remote:        > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
remote:
remote:        sharp: Detected globally-installed libvips v8.10.6
remote:        sharp: Building from source via node-gyp
remote:        readelf: Error: '/app/vendor/vips/lib/libvips-cpp.so': No such file
remote:        gyp: Call to 'if readelf -Ws "$(PKG_CONFIG_PATH="/tmp/build_1f4c5c03/.apt/usr/lib/x86_64-linux-gnu/pkgconfig:/tmp/build_1f4c5c03/.apt/usr/lib/i386-linux-gnu/pkgconfig:/tmp/build_1f4c5c03/.apt/usr/lib/pkgconfig::/tmp/build_1f4c5c03/vendor/vips/lib/pkgconfig:/tmp/build_1f4c5c03/.apt/usr/lib/x86_64-linux-gnu/pkgconfig:/tmp/build_1f4c5c03/.apt/usr/lib/i386-linux-gnu/pkgconfig:/tmp/build_1f4c5c03/.apt/usr/lib/pkgconfig::/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --variable libdir vips-cpp)/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi' returned exit status 0 while in binding.gyp. while trying to load binding.gyp

非常感谢您的帮助!

【问题讨论】:

    标签: node.js heroku node-gyp sharp


    【解决方案1】:

    最后发现 heroku 正在一个目录/tmp/build_1f4c5c03 中创建整个/app 文件夹,该目录还包含新安装的供应商。在我的.pc 文件中,该包位于/app,因此无法找到。我使用heroku-prebuild npm 脚本来sed 放置路径:

    TMP_DIR=$(pwd)
    
    for file in $(grep -rl /app/vendor ${TMP_DIR}/vendor/vips/lib/pkgconfig)
    do
      sed -i "s+/app/vendor+${TMP_DIR}/vendor+g" $file
    done
    

    不完全确定这是最好的方法......

    【讨论】:

      猜你喜欢
      • 2015-03-31
      • 2019-05-26
      • 2015-11-24
      • 1970-01-01
      • 1970-01-01
      • 2016-03-30
      • 2022-08-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多