OpenShift上的NodeJS应用程序:/lib64/libz.so.1:未找到版本"ZLIB_1.2.9" [英] NodeJS app on OpenShift: /lib64/libz.so.1: version `ZLIB_1.2.9' not found

查看:174
本文介绍了OpenShift上的NodeJS应用程序:/lib64/libz.so.1:未找到版本"ZLIB_1.2.9"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Stackoverflow的新手,所以大家好!

I'm new to Stackoverflow, so "hi" to everyone!

在OpenShift Online(免费的入门帐户)上进行部署也是我的新手.部署需要NPM打包的夏普( https://www的个人NodeJS应用时,我遇到以下错误. npmjs.com/package/sharp ).

I'm also new to deployment on OpenShift Online (free starter account). I run into the following error when deploying a personal NodeJS app requiring NPM-package sharp (https://www.npmjs.com/package/sharp).

该应用是二进制版本"( https:直接从本地Git存储区////docs.openshift.com/container-platform/3.6/dev_guide/dev_tutorials/binary_builds.html ).开始构建时,我得到以下输出(相关的初始行):

The app is a "binary build" (https://docs.openshift.com/container-platform/3.6/dev_guide/dev_tutorials/binary_builds.html) directly from a local Git repo. When starting the build, I get the following output (initial, relevant lines):

Receiving source from STDIN as archive ...
Pulling image "docker-registry.default.svc:5000/openshift/nodejs@sha256:0486de81685b610e47314d8b100c4cfae65edb3294d02f0a29ea57408e171fb6" ...
---> Installing application source ...
---> Installing all dependencies

> sharp@0.20.5 install /opt/app-root/src/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.6.1/libvips-8.6.1-linux-x64.tar.gz
prebuild-install WARN install /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /opt/app-root/src/node_modules/sharp/build/Release/../../vendor/lib/libpng16.so.16)
...

构建完成并自动触发新的部署,但是启动失败,当然:

The build finishes and auto-triggers a new deployment, which fails starting, of course:

Environment: 
    DEV_MODE=false
    NODE_ENV=production
    DEBUG_PORT=5858
Launching via npm...
npm info it worked if it ends with ok
npm info using npm@5.6.0
npm info using node@v8.9.4
...
> node app.js

module.js:672
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /opt/app-root/src/node_modules/sharp/build/Release/../../vendor/lib/libpng16.so.16)
    at Object.Module._extensions..node (module.js:672:18)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/opt/app-root/src/node_modules/sharp/lib/constructor.js:10:15)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/opt/app-root/src/node_modules/sharp/lib/index.js:3:15)
    at Module._compile (module.js:643:30)

我在Electron( https://github.com的上下文中找到了关于此错误的一些讨论. com/lovell/sharp/issues/892 )或同时使用节点画布(我不这样做; https://github.com/lovell/sharp/issues/843 ).由于我也不熟悉Dockers等,因此很难提取与我的案例相关的信息.

I found several discussions on this error in the context of Electron (https://github.com/lovell/sharp/issues/892) or when node-canvas is also used (which I don't; https://github.com/lovell/sharp/issues/843). It's hard for me to extract the information relevant for my case, since I'm also not familiar with Dockers etc.

在我的本地计算机上(Ubuntu 16.04)可以很好地安装该锋利的软件包,因此该应用程序可以正常运行.我还尝试在主app.js文件中明确要求Sharp作为第一行,这没有帮助.

The sharp package installed fine on my local machine (Ubuntu 16.04), and consequently, the app runs fine. I also tried explicitly requiring sharp as very first line in my main app.js file, which did not help.

感谢所有帮助,谢谢!

编辑7月2日:在上述与电子有关的讨论中,我想到了设置环境变量的想法

Edit July 2: From the above-mentioned Electron-related discussion, I took the idea to set the env-variable

LD_PRELOAD="/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so"

在OpenShift上的NodeJS-app的构建环境中.构建日志更改如下:

in the build-environment for the NodeJS-app on OpenShift. The build log changed as follows:

Receiving source from STDIN as archive ...
Pulling image "docker-registry.default.svc:5000/openshift/nodejs@sha256:0486de81685b610e47314d8b100c4cfae65edb3294d02f0a29ea57408e171fb6" ...
ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded: ignored.
---> Installing application source ...
ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded: ignored.
---> Installing all dependencies
ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded: ignored.

> sharp@0.20.5 install /opt/app-root/src/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded: ignored.
info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-linux-x64.tar.gz 
added 170 packages in 19.982s

构建过程中的警告已消失,但该应用程序仍然无法启动,并且错误与之前完全相同. (是的,在主app.js中,我确实首先加载了Sharp.)

The warning during the build is gone, but the app still does not startup with exactly the same error than before. (And yes, I do load sharp as first thing in the main app.js.)

我不能以某种方式直接告诉NodeJS(在主app.js中)为某些路径(或库)提供优先级吗?

Can't I somehow directly tell NodeJS (in the main app.js) to give preference to some path (or library)?

推荐答案

现在,我已经解决了该问题.将LD_PRELOAD变量添加到内部版本和部署环境并没有帮助.但是,一旦我修改了npm start脚本以在启动应用程序之前添加变量,它就会起作用:

By now I solved the problem. Adding the LD_PRELOAD variable to the build and the deployment environments did not help. However, it worked once I modified the npm start script to add the variable before starting the app:

"start": "LD_PRELOAD='/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' node app.js"

在我的主要app.js文件中,我仍然首先需要Sharp.没有测试这是否真的必要.

I am still requiring sharp as first thing in my main app.js file; did not test whether this is actually necessary.

这篇关于OpenShift上的NodeJS应用程序:/lib64/libz.so.1:未找到版本"ZLIB_1.2.9"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆