我将 node-oracledb 的 dockerized 设置(基于 docker-node-oracle)与 Node 10 一起使用,但是当我启动容器时,此错误不断弹出:
backend_1 | /app/node_modules/oracledb/lib/oracledb.js:68
backend_1 | throw new Error(nodbUtil.getErrorMessage('NJS-045', nodeInfo));
backend_1 | ^
backend_1 |
backend_1 | Error: NJS-045: cannot load the oracledb add-on binary for Node.js 10.4.1 (linux, x64)
backend_1 | Cannot load /app/node_modules/oracledb/build/Release/oracledb.node
backend_1 | /app/node_modules/oracledb/build/Release/oracledb.node: invalid ELF header
backend_1 | Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html
backend_1 | You must have 64-bit Oracle client libraries in LD_LIBRARY_PATH, or configured with ldconfig.
backend_1 | If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from
backend_1 | http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
backend_1 |
backend_1 | at Object.<anonymous> (/app/node_modules/oracledb/lib/oracledb.js:68:13)
backend_1 | at Module._compile (internal/modules/cjs/loader.js:702:30)
backend_1 | at Module._extensions..js (internal/modules/cjs/loader.js:713:10)
backend_1 | at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:152:7)
backend_1 | at Module.load (internal/modules/cjs/loader.js:612:32)
backend_1 | at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
backend_1 | at Function.Module._load (internal/modules/cjs/loader.js:543:3)
backend_1 | at Module.require (internal/modules/cjs/loader.js:650:17)
backend_1 | at require (internal/modules/cjs/helpers.js:20:18)
backend_1 | at Object.<anonymous> (/app/node_modules/oracledb/index.js:1:18)
我已经尝试过使用不同的节点版本(8 和 9),但同样的错误不断弹出,这表明我的图像设置可能存在问题,但我不知道是什么。这是码头文件:
# INSTALL UBUNTU
FROM node:10
#INSTALL LIBAIO1 & UNZIP (NEEDED FOR STRONG-ORACLE)
RUN apt-get update \
&& apt-get install -y libaio1 \
&& apt-get install -y build-essential \
&& apt-get install -y unzip \
&& apt-get install -y curl
#ADD ORACLE INSTANT CLIENT
RUN mkdir -p opt/oracle
ADD ./oracle/linux/ .
# 12.2
RUN unzip instantclient-basic-linux.x64-12.2.0.1.0 -d /opt/oracle \
&& mv /opt/oracle/instantclient_12_2 /opt/oracle/instantclient
RUN cd /opt/oracle/instantclient \
&& ln -s libclntsh.so.12.1 libclntsh.so \
&& ln -s libocci.so.12.1 libocci.so
RUN echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf
ENV LD_LIBRARY_PATH="/opt/oracle/instantclient"
WORKDIR app
ARG NODE_ENV
ENV NODE_ENV $NODE_ENV
COPY package.json .
RUN npm install
COPY . .
RUN ./build.sh
CMD [ "./up.sh" ]
任何知道/遇到 node-oracledb 问题的人?