SAP / node-rfc

Asynchronous, non-blocking SAP NW RFC SDK bindings for Node.js
Apache License 2.0
249 stars 73 forks source link

Installation steps and environment variables #270

Closed lualtabs closed 1 year ago

lualtabs commented 1 year ago

Hi, my quewstions are: 1) Is it necessary to install SAP NWRFC SDK first and then node-rfc? 2) In SAP NWRFC SDK Installation for windows, it says: "4-Include the lib directory to the library search path on Windows, i.e. add to PATH environment variable: PS C:> $env:Path += ";$env:SAPNWRFC_HOME\lib" ". I don't understand what is means by this instruction "PS C:> $env:Path += ";$env:SAPNWRFC_HOME\lib", maybe I can assign the value c:\nwrfcsdk\lib to the SAPNWRFC_HOME environment variable at the moment to create it?

Thanks, Luis Tafur.

bsrdjan commented 1 year ago

Hello Luis Tafur,

yes, SAP NWRFC SDK must be installed first. It is available on different SAP software delivery channel and not packaged with node-rfc.

After SAP NWRFC SDK is installed, the SAPNWRFC_HOME env variable shall be set to RFC SDK "root folder", likec:\nwrfcsdk. It is one level below lib folder. The lib folder shall be added to PATH, like PATH=%c:\nwrfcsdk\lib

Hope this helps

Regards, Srdjan

lualtabs commented 1 year ago

Thanks, Mr. Bsrdjan. I have created the following in Windows 10:

  1. I installed the SAP NWRFC SDK. The directory is C:\nwrfcsdk
  2. I set the environment variables in windows like so: 2.1. Env Variable SAPNWRFC_HOME.

image

2.2. then I added to the PATH the directory \lib like this:

image

  1. I installed the nodejs. In c:\ with the name suggested in the installer.
  2. in the following directory install the npm install node-rfc. In this I have my function.js program.

image

  1. I created the sapnwrfc.ini file in the directory where I have the function.js program.
  2. When I execute the program in visual studio with debug option

image

on the first line an error occurs.

The error is:

C:\Program Files\nodejs\node.exe .\function.js
Uncaught Error Error: No se puede encontrar el módulo especificado.
\\?\e:\cursos\JS\node_modules\node-rfc\lib\binding\sapnwrfc.node

 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
environment: {
  "platform": {
    "name": "win32",
    "arch": "x64",
    "release": "10.0.19043"
  },
  "env": {
    "SAPNWRFC_HOME": "C:\\nwrfcsdk",
    "RFC_INI": "",
    "nwrfcsdk_lib_on_path": true
  },
  "versions": {
    "node": "16.14.0",
    "v8": "9.4.146.24-node.20",
    "uv": "1.43.0",
    "zlib": "1.2.11",
    "brotli": "1.0.9",
    "ares": "1.18.1",
    "modules": "93",
    "nghttp2": "1.45.1",
    "napi": "8",
    "llhttp": "6.0.4",
    "openssl": "1.1.1m+quic",
    "cldr": "40.0",
    "icu": "70.1",
    "tz": "2021a3",
    "unicode": "14.0",
    "ngtcp2": "0.1.0-DEV",
    "nghttp3": "0.1.0-DEV"
  }
}
    at Module._extensions..node (internal/modules/cjs/loader:1185:18)
    at Module.load (internal/modules/cjs/loader:981:32)
    at Module._load (internal/modules/cjs/loader:822:12)
    at Module.require (internal/modules/cjs/loader:1005:19)
    at require (internal/modules/cjs/helpers:102:18)
    at <anonymous> (e:\cursos\JS\node_modules\node-rfc\lib\wrapper\noderfc-bindings.js:36:49)
    at Module._compile (internal/modules/cjs/loader:1103:14)
    at Module._extensions..js (internal/modules/cjs/loader:1155:10)
    at Module.load (internal/modules/cjs/loader:981:32)
    at Module._load (internal/modules/cjs/loader:822:12)
    at Module.require (internal/modules/cjs/loader:1005:19)
    at require (internal/modules/cjs/helpers:102:18)
    at <anonymous> (e:\cursos\JS\node_modules\node-rfc\lib\index.js:20:14)
    at Module._compile (internal/modules/cjs/loader:1103:14)
    at Module._extensions..js (internal/modules/cjs/loader:1155:10)
    at Module.load (internal/modules/cjs/loader:981:32)
    at Module._load (internal/modules/cjs/loader:822:12)
    at Module.require (internal/modules/cjs/loader:1005:19)
    at require (internal/modules/cjs/helpers:102:18)
    at <anonymous> (e:\cursos\JS\function.js:1:17)
    at Module._compile (internal/modules/cjs/loader:1103:14)
    at Module._extensions..js (internal/modules/cjs/loader:1155:10)
    at Module.load (internal/modules/cjs/loader:981:32)
    at Module._load (internal/modules/cjs/loader:822:12)
    at executeUserEntryPoint (internal/modules/run_main:77:12)
    at <anonymous> (internal/main/run_main_module:17:47)
Process exited with code 1

I do not know what I'm doing wrong

Best regards, Luis Alberto Tafur.

bsrdjan commented 1 year ago

To check if the correct SAP NWRFC SDK installed on your system, could you please

1) Verify the RFC SDK release as described here

2) Run rfcexec and let me know the output

cd %SAPNWRFC_HOME%/bin
rfcexec
lualtabs commented 1 year ago

Hello Mr. Bsrdjan.

I downloaded a new version of the SDK because when I ran the "rfcexec" file, it did not have an .exe extension.

Now, continuing with your suggestions.

At point No. 1. After having installed the SAP NW RFC SDK image

Verifying environment variable PATH image

image

When I execute. @echo off findstr Patch %SAPNWRFC_HOME%\lib\sapnwrfc.dll

I have created the “instalacion_sapnwrfc.bat” file, The result is: c:>instalacion_sapnwrfc
750 Patch Level 10

At point number 2. To run these instructions: cd %SAPNWRFC_HOME%/bin rfcexec

image

two errors are generated: image This is the message :“Code execution cannot continue because sapnwrfc.dll was not found. This problem can be fixed by reinstalling the program”

image This is the message: “Code execution cannot continue because LIBSAPUCUM.dll was not found This problem can be solved by reinstalling the program.”.

Best regards, Luis Alberto Tafur.

bsrdjan commented 1 year ago

Could it be you downloaded the 32bit version of SAP NWRFC SDK ?

To check the consistency of your SAP NWRFC SDK files, please post the content of %SAPNWRFC_HOME%\lib directory

cd c:\nwrfcsdk\lib
dir
lualtabs commented 1 year ago

Hello Mr. Bsrdjan.

when I check the version with the following lines:

@echo off findstr Patch %SAPNWRFC_HOME%\lib\sapnwrfc.dll

The result is:

750 Patch Level 10

My directory image

Thanks, Luis Alberto Tafur.

bsrdjan commented 1 year ago

The content looks good. Could it be that another copy of RFC SDK is on PATH before c:\nwrdcsdk\lib ?

Can you put c:\nwrdcsdk\lib first on PATH and check?

Which Windows version is used?

bsrdjan commented 1 year ago

Please re-open if not solved in the meantime