my server
[root@localhost bin]# uname -a
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost bin]# export
declare -x HISTCONTROL="ignoredups"
declare -x HISTSIZE="1000"
declare -x HOME="/root"
declare -x HOSTNAME="localhost.localdomain"
declare -x LANG="zh_CN.UTF-8"
declare -x LD_LIBRARY_PATH="/opt/oracle/instantclient:/lib"
declare -x LESSOPEN="||/usr/bin/lesspipe.sh %s"
declare -x LOGNAME="root"
declare -x LS_COLORS="rs=0:di=38;5;27:ln=38;5;51:mh=44;38;5;15:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=05;48;5;232;38;5;15:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;34:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.Z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.axa=38;5;45:*.oga=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:"
declare -x MAIL="/var/spool/mail/root"
declare -x OCI_INC_DIR="/opt/oracle/instantclient/sdk/include"
declare -x OCI_LIB_DIR="/opt/oracle/instantclient"
declare -x OLDPWD="/usr/local/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/mysql/bin:/root/bin"
declare -x PWD="/usr/local/bin"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_TTY="/dev/pts/0"
declare -x TERM="xterm-256color"
declare -x USER="root"
declare -x XDG_RUNTIME_DIR="/run/user/0"
declare -x XDG_SESSION_ID="54001"
[root@localhost oracle]# node-gyp --version
v3.4.0
[root@localhost bin]# npm install --python=/usr/lib64/python2.7 oracledb
> [email protected] install /data/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules/oracledb
> node-gyp rebuild
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn EACCES
gyp ERR! stack at exports._errnoException (util.js:1012:11)
gyp ERR! stack at ChildProcess.spawn (internal/child_process.js:302:11)
gyp ERR! stack at exports.spawn (child_process.js:372:9)
gyp ERR! stack at exports.execFile (child_process.js:139:15)
gyp ERR! stack at checkPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:371:5)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:338:9
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:88:20
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:44:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/access.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Linux 3.10.0-123.el7.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /data/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules/oracledb
gyp ERR! node -v v6.3.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
npm WARN [email protected] No repository field.
npm ERR! Linux 3.10.0-123.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--python=/usr/lib64/python2.7" "oracledb"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the oracledb package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs oracledb
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls oracledb
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /data/app/taf/tafnode/data/CRM.GrayServer/bin/npm-debug.log
please tell me where the problem is or whether there is something wrong with oracledb itself
plz
The EACCES error indicates a problem at your end. Check your user permissions and also check network permissions. You may need to set http_proxy. See https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#instzip
Recently I've had a lot of transient install failures due to network glitches. Could be my network but it might also be an npmjs.com problem.
I have read the install guide(https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#instzip) carefully, and i confirm the network is OK。
There are several versions of python on my linux server
[root@localhost bin]# whereis python
python: /usr/bin/python /usr/bin/python2.7 /usr/lib/python2.7 /usr/lib64/python2.7 /usr/include/python2.7 /usr/share/man/man1/python.1.gz
When I install oracledb whithout --python=/usr/lib64/python2.7, it seems OK when installing, but i cannnot use oracledb in my nodejs script due to the errors below.
[root@localhost bin]# npm install oracledb
> [email protected] install /data/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules/oracledb
> node-gyp rebuild
make: 进入目录“/data/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules/oracledb/build”
CXX(target) Release/obj.target/oracledb/src/njs/src/njsOracle.o
CXX(target) Release/obj.target/oracledb/src/njs/src/njsPool.o
CXX(target) Release/obj.target/oracledb/src/njs/src/njsConnection.o
CXX(target) Release/obj.target/oracledb/src/njs/src/njsResultSet.o
CXX(target) Release/obj.target/oracledb/src/njs/src/njsMessages.o
CXX(target) Release/obj.target/oracledb/src/njs/src/njsIntLob.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiEnv.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiEnvImpl.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiException.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiExceptionImpl.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiConnImpl.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiDateTimeArrayImpl.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiPoolImpl.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiStmtImpl.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiUtils.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiLob.o
CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiCommon.o
SOLINK_MODULE(target) Release/obj.target/oracledb.node
COPY Release/oracledb.node
make: 离开目录“/data/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules/oracledb/build”
[email protected] /data/app/taf/tafnode/data/CRM.GrayServer/bin
└── [email protected]
Error: /data/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules/oracledb/build/Release/oracledb.node: invalid ELF header
at Error (native)
at Object.Module._extensions..node (module.js:568:18)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/data/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules/oracledb/lib/oracledb.js:35:19)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10) Error: /data/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules/oracledb/build/Release/oracledb.node: invalid ELF header
at Error (native)
at Object.Module._extensions..node (module.js:568:18)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/data/app/taf/tafnode/data/CRM.GrayServer/bin/node_modules/oracledb/lib/oracledb.js:35:19)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
It indicates that oracledb is not rebuilded successfully.
From googling (feel free to google yourself, hint, hint) Try running 'rm -rf node_module && npm cache clean' before installing. I haven't seen the error before that I recall, so keep investigating until you can identify a cause.
I have solved it!!
it is due to uninstallation of libiao
@dacuotecuo can you please elaborate on your last comment?
Is it important to install libaio ?? I only have libaio1 ... If you have some spare time, please post some step by step instructions!
@cjbj tip fixed it for me, I'm building a Docker image and in my Dockerfile I have the following steps
RUN rm -rf node_modules && npm cache clean
RUN npm install --production
I was getting invalid ELF header error while building the docker image of my code. Turned out that while building the docker image, node modules from local machine (macOS) were getting copied into the image along the Nodejs code. @danifitz It might be the same problem with you too.
Full error message that i was getting.
/src/node_modules/oracledb/lib/oracledb.js:68
throw new Error(nodbUtil.getErrorMessage('NJS-045', nodeInfo));
^
Error: NJS-045: cannot load the oracledb add-on binary for Node.js 8.12.0 (linux, x64)
Cannot load /src/node_modules/oracledb/build/Release/oracledb.node
/src/node_modules/oracledb/build/Release/oracledb.node: invalid ELF header
Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html
You must have 64-bit Oracle client libraries in LD_LIBRARY_PATH, or configured with ldconfig.
If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
at Object.<anonymous> (/src/node_modules/oracledb/lib/oracledb.js:68:13)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/src/node_modules/oracledb/index.js:1:80)
at Module._compile (module.js:653:30)
@diwakar-s-maurya thanks for sharing.
Docker users may also be interested in my blog post Oracle Instant Client-based Middle Tiers Such As Docker Without a Click-through
@diwakar-s-maurya I developed a project on the Windows 10 OS and it worked fine. Then in production server (CentOS) I build the docker image of my project. I had the same error as you when check docker logs. How you fix that problem?
@cjbj I am interested in your last commend where you recommend to use Dockerfile to Oracle Instant Client. I am little bit confused. Right know I have such pretty simple Dockerfile:
FROM node:latest
COPY / ./
EXPOSE 3001
CMD [ "npm", "start" ]
Question: I need to add you code to mine or create separate docker image?
@NogerbekNurzhan this is an old, closed issue. let's follow up using your new issue.
Most helpful comment
@dacuotecuo can you please elaborate on your last comment?
Is it important to install libaio ?? I only have libaio1 ... If you have some spare time, please post some step by step instructions!