node-rfc: npm install node-rfc doesn't work

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 node-rfc@0.1.11 and node@8.5.0 (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: 2 gyp 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.<anonymous> (/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! node-rfc@0.1.11 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-rfc@0.1.11 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!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 27 (12 by maintainers)

Most upvoted comments

@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 COPY instruction from your host into the image instead.

I build this image with docker build --build-arg JFROG_CREDENTIALS=user:pass -t saprfc . You can specify --build-arg node=node:8.9.1 to use the latest Node.js base image 8.9.1 instead of 6.12.0.

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.

$ ./sxmicli.sh RSPO_SXOMS_VERSION "{}"
module.js:597
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /code/node_modules/node-rfc/build/rfc/rfc.node)
    at Error (native)
    at Object.Module._extensions..node (module.js:597:18)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/code/node_modules/node-rfc/index.js:6:11)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)

Just released 0.1.12 has 8.9 included and you may test in your system.