-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm install node-rfc doesn't work #35
Comments
I had this issue. My problem was my path was not set correctly with the NWRFCSDK lib path. Described here |
Pre-compiled binary might not be available for your nodejs version. Which nodejs version are you using ? The build from source should anyway work, with SAPNWRFC_HOME set to base folder of sapnwrfcsdk installed on your system (see my answer in #36). |
I am facing the same issue installing on Linux with node.js 8.9.1 version. Any idea? What am I missing? |
Pre-compiled binary is not available for 8.9.1, only the build from source. |
Just released 0.1.12 has 8.9 included and you may test in your system. |
Thanks @bsrdjan. |
Awesome @bsrdjan, I tried to install on Windows, but still get 0.1.11 from npmjs.org |
Thank you very much @StefanScherer for catching this one. The version publish failed on npmjs, now should be fixed. |
@bsrdjan Thanks for the update. I've tried it with Node.js 8.9.1 on Windows, but during the installation I see this error:
|
Thank you Stefan, binary names should be fixed now. Please feel free to check. |
I tried 0.1.12 in a Linux container, based on
It works fine if I switch back to 0.1.11. Dependencies of the 0.1.11 version:
Dependencies of the 0.1.12 version:
|
I ran another test in a Windows Server Core container and DLL's can be loaded with both 0.1.11 and 0.1.12 using Node.js 6.12.0. BTW: I first tried the smaller NanoServer container, but it seems the the nwsdk DLL and binaries (from NWRFC_38-20004568.SAR) don't work in NanoServer. Will do a more deep test if I have a SAP system at hand to connect to. |
Same error appears with Windows with Both Linux and Windows fail of course when trying with 0.1.11. |
@bsrdjan,. I am not sure this is place to ask but any help is much appreciated. |
@PrakashSadasivam, regarding AWS Lambda, I am not much familiar with that platform and similar question is posted for Python RFC Connector SAP-archive/PyRFC#51. Both Python and nodejs RFC connector require native SAP NW RFC SDK libraries to be deployed. If that not possible, these connectors can't be used on that platform. If your target SAP system has HANA database and access to database is enough for your case, you may try HANA db connectors for Python and nodejs. They have no native dependencies and should work on Lambda as well. These connectors are restricted to HANA and can't expose ABAP business logic. |
@StefanScherer, I am testing on fresh new installed Ubuntu server images and on standard Windows images and no errors happen there. Regarding libstdc error, could it be that the library is missing on Linux container: https://askubuntu.com/questions/575505/glibcxx-3-4-20-not-found-how-to-fix-this-error ? Regarding other containers, if the standard installation fails, the build from source should help. No capacity atm. for testing on more premise and cloud containers. |
Thanks @bsrdjan Just some details to the official
|
@ bsrdjan ; regarding the AWS Lambda question: we are able to upload custom SAP libraries into Lambda. however we are not able to use the system bin/lib folders and are running into reference issues. we would like to understand how to compile the code with local reference paths...relative paths so we can use it on Lambda... Thank you! |
@StefanScherer, which docker image exactly I could use for testing ? |
@bsrdjan I don't have a public repo available to show it, so I can roughly explain how we build a base image for our test environment. Dockerfile for base image with SDK: ARG node=node:6.12.0
FROM $node AS download
ARG JFROG_CREDENTIALS
RUN \
curl -f -u ${JFROG_CREDENTIALS} -o SAPCAR_0-80000935.EXE "https://url-to/SAPCAR_617-80000935.EXE" && \
curl -f -u ${JFROG_CREDENTIALS} -o NWRFC_38-20004565.SAR "https://url-to/NWRFC_38-20004565.SAR" && \
chmod +x SAPCAR_0-80000935.EXE && \
./SAPCAR_0-80000935.EXE -xvf NWRFC_38-20004565.SAR && \
rm SAPCAR_0-80000935.EXE && \
rm NWRFC_38-20004565.SAR && \
echo "/nwrfcsdk/lib" > /etc/ld.so.conf.d/saprfc.conf && \
ldconfig
FROM $node
ENV \
SAPRFC_VERSION=7210.0.38
COPY --from=download /nwrfcsdk /nwrfcsdk
RUN \
echo "/nwrfcsdk/lib" > /etc/ld.so.conf.d/saprfc.conf && \
ldconfig This is a multi-stage Dockerfile which works fine with Docker 17.05 or newer to remove the download credentials of the first download stage. If you have the files locally, just use a I build this image with Then you need an application package.json: {
"name": "sxmicli",
"version": "0.0.2",
"description": "Call SXMI functions from command line.",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"node-rfc": "0.1.12"
}
} app.js: "use strict";
var rfc = require('node-rfc');
var dest = process.env.DEST || 'yourdefault';
var extCompany = process.env.EXTCOMPANY || 'yourdefault';
var extProduct = process.env.EXTPRODUCT || 'yourdefault';
var sxmiCommand = process.env.COMMAND || '';
var sxmiOptions = process.env.OPTIONS || '';
var client = new rfc.Client({ dest }, true);
console.log('Connecting to', dest);
client.connect((err) => {
var func;
if (err) {
return console.error('could not connect to server', err);
}
console.log('Connected');
func = client.invoke('SXMI_VERSIONS_GET', { INTERFACE: 'XOM' }, function(err, res) {
if (err) {
return console.error('Error invoking SXMI_VERSIONS_GET:', err);
}
func = client.invoke('SXMI_LOGON', {
EXTCOMPANY: extCompany,
EXTPRODUCT: extProduct,
INTERFACE: 'XOM',
VERSION: res.VERSIONS[0].VERSION
}, function(err, res) {
if (err) {
return console.error('Error invoking SXMI_LOGON:', err);
}
var options;
eval('options =' + sxmiOptions);
func = client.invoke(sxmiCommand, options, function(err, res) {
if (err) {
return console.error('Error invoking ' + sxmiCommand + ':', err);
}
console.log('Result:', res);
func = client.invoke('SXMI_LOGOFF', {
INTERFACE: 'XOM'
}, function(err, res) {
if (err) {
return console.error('Error invoking SXMI_LOGOFF:', err);
}
});
});
});
});
}); Add a sapnwrfc.ini. Dockerfile for the app: FROM saprfc
WORKDIR /code
COPY package.json /code/package.json
RUN npm install --production
COPY . /code
CMD ["node", "app.js"] I use a small helper bash script to run this container sxmicli.sh: #!/bin/bash
export COMMAND=$1
export OPTIONS=$2
docker run -e COMMAND -e OPTIONS --rm -it plossys/sxmicli You can run it eg.
|
I did this hacky Dockerfile to force compilation by blocking requests to github.com: FROM saprfc
WORKDIR /code
COPY package.json /code/package.json
#RUN npm install --production
# poor man's solution to compile node-rfc from source
RUN cp /nwrfcsdk/include/* /usr/include && \
cp /nwrfcsdk/lib/* /usr/lib && \
echo "127.0.0.1 github.com" >>/etc/hosts && \
npm install --production
COPY . /code
CMD ["node", "app.js"] This really should be considered as a quick hack to test if compilation works. |
Thanks @StefanScherer, will check that. @PrakashSadasivam, is there perhaps a docker image for local testing AWS Lambda as well? Can you eventually provide the configuration? I opened new issue for this, let please continue there: #40 . |
@StefanScherer , I am working on building docker image for SAP node-rfc, if you have it build can you please share the docker file? |
Using your node-rfc docker container (minor adaptation) I had no issued while building from source for node-rfc 0.12: FROM node:8
ENV SAPNWRFC_HOME /nwrfcsdk
ENV LD_LIBRARY_PATH $SAPNWRFC_HOME/lib
# copy nwrfcsdk folder from files to image
COPY files /
WORKDIR /code
COPY package.json package.json
COPY app.js app.js
RUN npm install --build-from-source node-rfc
CMD ["node", "app.js"] When the issue with libc exactly happens ? |
@bsrdjan Thanks for The problem occurs when you just use |
The standard docker image is shipped with older GLIBCXX version, causing issues also with other npm modules. The Here how to login to docker node image shell: docker run -v $(pwd):/root -it node-rfc:docker /bin/bash and check GLIBC version: root@4091f79fd5ea:/code# ldd --version
ldd (Debian GLIBC 2.19-18+deb8u10) 2.19 |
To deploy node-rfc on lambda with NWRFCSDK libs |
Hi there,
i was trying to install node-rfc but I get this errors:
ode-pre-gyp ERR! Tried to download(404): https://github.com/sap/node-rfc/releases/download/0.1.11/rfc-v0.1.11-node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source compile with node-gyp)
make: Entering directory
/var/www/PRG/playground/authentication/node-rfc/build' CXX(target) Release/obj.target/rfc/src/rfc.o In file included from ../src/rfc.cc:16:0: ../src/Client.h:23:22: fatal error: sapnwrfc.h: No such file or directory #include <sapnwrfc.h> ^ compilation terminated. make: *** [Release/obj.target/rfc/src/rfc.o] Error 1 make: Leaving directory
/var/www/PRG/playground/authentication/node-rfc/build'gyp ERR! build error
gyp ERR! stack Error:
make
failed with exit code: 2gyp ERR! stack at ChildProcess.onExit (/opt/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.13.0-042stab124.2
gyp ERR! command "/opt/node/bin/node" "/opt/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/var/www/PRG/playground/authentication/node-rfc/build/rfc/rfc.node" "--module_name=rfc" "--module_path=/var/www/PRG/playground/authentication/node-rfc/build/rfc"
gyp ERR! cwd /var/www/PRG/playground/authentication/node-rfc
gyp ERR! node -v v8.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/opt/node/bin/node /opt/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/PRG/playground/authentication/node-rfc/build/rfc/rfc.node --module_name=rfc --module_path=/var/www/PRG/playground/authentication/node-rfc/build/rfc' (1)
node-pre-gyp ERR! stack at ChildProcess. (/var/www/PRG/playground/authentication/node-rfc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:125:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:213:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:927:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Linux 3.13.0-042stab124.2
node-pre-gyp ERR! command "/opt/node/bin/node" "/var/www/PRG/playground/authentication/node_modules/node-rfc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /var/www/PRG/playground/authentication/node-rfc
node-pre-gyp ERR! node -v v8.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute '/opt/node/bin/node /opt/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/var/www/PRG/playground/authentication/node-rfc/build/rfc/rfc.node --module_name=rfc --module_path=/var/www/PRG/playground/authentication/node-rfc/build/rfc' (1)
npm WARN enoent ENOENT: no such file or directory, open '/var/www/PRG/playground/authentication/package.json'
npm WARN authentication No description
npm WARN authentication No repository field.
npm WARN authentication No README data
npm WARN authentication No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install:
node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-09-25T13_53_07_192Z-debug.log
Has someone an idea?
Thanks a lot in advance!
The text was updated successfully, but these errors were encountered: