SAP / node-rfc

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

Can't get environment on Windows env #317

Closed fortezhuo closed 10 months ago

fortezhuo commented 10 months ago

Describe the bug After install python 3.10.x and set PATH of SAP RFC SDK.. I can install node-rfc. But it fails while fetch env with simple command

node -p "require('node-rfc')".environment
C:\Node\sap-connect>echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Node\;C:\Users\Administrator\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\Administrator\AppData\Local\Programs\Python\Python310\;C:\Users\Administrator\AppData\Local\Programs\Python\Launcher\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\AppData\Local\Programs\Microsoft VS Code\bin;C:\nwrfcsdk\lib;

C:\Node\sap-connect>echo %SAPNWRFC_HOME%
C:\nwrfcsdk

C:\Node\sap-connect>pnpm install
Packages: +114
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 137, reused 114, downloaded 0, added 114, done

dependencies:
+ del-cli 5.1.0
+ node-rfc 3.3.1
+ tsx 4.7.0

Done in 4.8s

C:\Node\sap-connect>node -p "require('node-rfc')".environment
C:\Node\sap-connect\node_modules\.pnpm\node-rfc@3.3.1\node_modules\node-rfc\lib\noderfc-bindings.js:44
    throw err;
    ^

Error: The specified module could not be found.
\\?\C:\Node\sap-connect\node_modules\.pnpm\node-rfc@3.3.1\node_modules\node-rfc\build\Release\sapnwrfc.node
environment: {
  "platform": {
    "name": "win32",
    "arch": "x64",
    "release": "10.0.17763"
  },
  "env": {
    "SAPNWRFC_HOME": "C:\\nwrfcsdk",
    "RFC_INI": "",
    "nwrfcsdk_lib_on_path": true
  },
  "versions": {
    "node": "18.16.0",
    "acorn": "8.8.2",
    "ada": "1.0.4",
    "ares": "1.19.0",
    "brotli": "1.0.9",
    "cldr": "42.0",
    "icu": "72.1",
    "llhttp": "6.0.10",
    "modules": "108",
    "napi": "8",
    "nghttp2": "1.52.0",
    "nghttp3": "0.7.0",
    "ngtcp2": "0.8.1",
    "openssl": "3.0.8+quic",
    "simdutf": "3.2.2",
    "tz": "2022g",
    "undici": "5.21.0",
    "unicode": "15.0",
    "uv": "1.44.2",
    "uvwasi": "0.0.15",
    "v8": "10.2.154.26-node.26",
    "zlib": "1.2.13"
  }
}

    at Module._extensions..node (node:internal/modules/cjs/loader:1338:18)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at load (C:\Node\sap-connect\node_modules\.pnpm\node-gyp-build@4.8.0\node_modules\node-gyp-build\node-gyp-build.js:22:10)

Notes On Mac M1 ARM.. I can install and get environemnt successfully

bsrdjan commented 10 months ago

Hello Hedi,

thank you for the detailed description. Did you check if SAP NW RFC SDK for Windows platform is installed, or for another platform perhaps? It is the most common installation issue.

To check, open the Windows console and cd to c:\nwrfcsdk\bin. Run the startrfc.exe in that folder, with -v argument. The output should be like below (tested on Mac ARM)

cd $SAPNWRFC_HOME/bin
./startrfc -v
RfcLogWrite: could not open /usr/local/sap/nwrfcsdk/bin/./dev_rfc_46095.log. Trace directory set to ./
NW RFC Library Version: 750 Patch Level 12
Compiler Version:
Version not available.
Startrfc Version: 2018-08-15 
fortezhuo commented 10 months ago

Thanks for your quick response. I have solved this issue by installing Visual C++ Redistributable Packages for Visual Studio 2013