Skip to content
\n

I call this script from my docker file.

\n
RUN chown user:user ./saprfc-install.sh\nRUN chmod +x ./saprfc-install.sh\nRUN exec ./saprfc-install.sh\n.\n.\n.\nCOPY node_modules $HOME/node_modules\n
\n

This is working fine in my dev and staging k8s environment. However when I am testing on my windows laptop with docker desktop deployed , I get following error when executing connection with SAP

\n

_'Error: /opt/node_modules/node-rfc/lib/binding/sapnwrfc.node: invalid ELF header\\n\\n The SAP NW RFC SDK could not be loaded, check the installation: https://github.com/SAP/node-rfc/blob/master/doc/installation.md#sap-nwrfc-sdk-installation\\nenvironment: {\\n \"platform\": {\\n \"name\": \"linux\",\\n \"arch\": \"x64\",\\n \"release\": \"5.10.16.3-microsoft-standard-WSL2\"\\n },\\n \"env\": {\\n \"SAPNWRFC_HOME\": \"/opt/nwrfcsdk\",\\n \"RFC_INI\": \"\"\\n },\\n \"versions\": {\\n \"node\": \"18.13.0\",\\n \"v8\": \"10.2.154.23-n…272:10)\\n at Module.load (node:internal/modules/cjs/loader:1081:32)\\n at Module._load (node:internal/modules/cjs/loader:922:12)\\n at Module.require (node:internal/modules/cjs/loader:1105:19)\\n at require (node:internal/modules/cjs/helpers:103:18)\\n at Object. (/opt/node_modules/@aas/xxx-sap_rfc-connector/common/lib/v1/RFCHelper.js:7:19)\\n at Module._compile (node:internal/modules/cjs/loader:1218:14)\\n at Module.extensions..js (node:internal/modules/cjs/loader:1272:10)'

\n

I am not able to figure out what's wrong with my local deployment.
\nI have verified all verifications from https://github.com/SAP/node-rfc/blob/main/doc/installation.md#sap-nwrfc-sdk-installation\\nenvironment. They seem to work as expected.

\n

Any thoughts on further investigation will be helpful.

\n

P.S. cat /etc/os-release output from both dev/staging is

\n

~$ cat /etc/os-release
\nPRETTY_NAME=\"Debian GNU/Linux 11 (bullseye)\"
\nNAME=\"Debian GNU/Linux\"
\nVERSION_ID=\"11\"
\nVERSION=\"11 (bullseye)\"
\nVERSION_CODENAME=bullseye
\nID=debian
\nHOME_URL=\"https://www.debian.org/\"
\nSUPPORT_URL=\"https://www.debian.org/support\"
\nBUG_REPORT_URL=\"https://bugs.debian.org/\"

","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

The problem could be

\n
COPY node_modules $HOME/node_modules\n
\n

I suppose node_modules on your Windows laptop include node-rfc installed there. The node-rfc is platform dependent and has a binary component for Windows and another one for Linux.

\n

If you installed node-rfc on Windows and copy node_modules from there to docker, the \"invalid ELF header\" will come up because docker Linux tries to load node-rfc for Windows.

\n

Can you just replace the COPY node_modules ... with npm install node-rfc ? That would install the proper Linux version of node-rfc.

","upvoteCount":1,"url":"https://github.com/SAP-archive/node-rfc/discussions/285#discussioncomment-5849174"}}}
Discussion options

You must be logged in to vote

The problem could be

COPY node_modules $HOME/node_modules

I suppose node_modules on your Windows laptop include node-rfc installed there. The node-rfc is platform dependent and has a binary component for Windows and another one for Linux.

If you installed node-rfc on Windows and copy node_modules from there to docker, the "invalid ELF header" will come up because docker Linux tries to load node-rfc for Windows.

Can you just replace the COPY node_modules ... with npm install node-rfc ? That would install the proper Linux version of node-rfc.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by sharangthorat
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants