Closed nikmalenovic closed 2 years ago
I could not exactly reproduce and observe slightly different behaviour on test system:
global
npm -g i node-rfc
local
npm init -y
node -p "require('node-rfc').environment" # error
Error: Cannot find module 'node-rfc'
node-rfc is initially not found because NODE_PATH was not set and global modules can't be required. Once it is set, the node-rfc works fine:
npm -g root
C:\Tools\nodejs\node_modules
set NODE_PATH=C:\Tools\nodejs\node_modules
node -p "require('node-rfc').environment" # ok
Is NODE_PATH set on your system and to which path?
The NODE_PATH
is not set. I set it to my npm -g root
location and it made no difference.
hm, not sure what exactly goes wrong because I could not reproduce.
Could you eventually try with new created project folder ? Eventually with another node version, just in case ...?
Here what works for me:
mkdir i226
cd i226
npm init -y
npm -g install node-rfc
# does not work w/o npm link
node -p "require('node-rfc').environment"
^
Error: Cannot find module 'node-rfc'
# works after npm link
npm link node-rfc
C:\src\i226\node_modules\node-rfc -> C:\Tools\nodejs\node_modules\node-rfc
node -p "require('node-rfc').environment"
{
platform: { name: 'win32', arch: 'x64', release: '10.0.19042' },
env: {
SAPNWRFC_HOME: 'C:\\Tools\\nwrfcsdk',
RFC_INI: '',
nwrfcsdk_lib_on_path: true ...
# does not work after npm unlink
npm unlink node-rfc
npm WARN i226@1.0.0 No description
npm WARN i226@1.0.0 No repository field.
}
removed 1 package in 0.592s
found 0 vulnerabilities
node -p "require('node-rfc').environment"
^
Error: Cannot find module 'node-rfc'
# works with NODE_PATH
$env:NODE_PATH="C:\Tools\nodejs\node_modules"
node -p "require('node-rfc').environment"
{
platform: { name: 'win32', arch: 'x64', release: '10.0.19042' },
env: {
SAPNWRFC_HOME: 'C:\\Tools\\nwrfcsdk',
RFC_INI: '',
nwrfcsdk_lib_on_path: true ...
Could you eventually try with new created project folder ? Eventually with another node version, just in case ...?
I tried with both LTS 14 and latest 16. Also tried both a new project with a link and a new project without global install. All attempts ended up with identical failure.
I tried a third "clean" 2012 R2. Installed nodejs LTS 14.17.3 without tools (choco, build tools, python). DIdn't install visual studio c++ build environment, cmake. Installed MSVC 2013 x64 redistributable, NW RFC SDK 7.50.8 into C:\nwrfcsdk
, set SAPNWRFC_HOME=c:\nwrfcsdk
, added %SAPNWRFC_HOME%\lib
to PATH. Installed node-rfc into C:\temp
, and ran node -p "require('node-rfc').environment"
and it worked. Since systems are identical, why would one work and not the other? your guess is as good as mine - it'd be nice to get better trace diagnostics to identify what is the root cause of the issue.
And yes, I did try cleaning up the broken machines, re-installing from scratch like the one that works, but it produced identical failed result again.
The installation sequence of Windows redistributables and dependencies sometimes matters on Windows. Few users reported (over years) that fresh new Windows installation was the only way to resolve. It might be an issue with dependencies but hard to guess without further analysis.
To find out what is exactly failing on affected system, could you try to activate the Windows Process Monitor, run the node -p "require('node-rfc').environment
to reproduce the issue and check Process Monitor logs afterwards ? The log should show problematic library, like here for example: https://github.com/SAP/node-rfc/issues/127#issuecomment-600020359.
SAP test program rfcexec.exe
does not load all SAP NWRFC SDK binaries when started w/o parameters and is therefore not 100% proof that all SDK binaries and dependencies are correctly installed. Process Monitor should help localise the problem.
Could you please also test if it works with node-rfc 2.4.2 ? There is similar issue starting from node-rfc 2.4.3 but not sure if related.
procmon64 did it's job - filtered it by Process Name = node.exe - it showed it was loading NW RFC SDK DLLs from C:\Windows\System32 - after a bit of poking had to remove sapnwrfc.dll (along with libicudecnumber.dll and libsapucum.dll) from C:\Windows\System32 and C:\Windows\SysWOW64 and viola - it works. Closing. Thanks!
Glad it is solved :) The https://github.com/SAP/node-rfc/issues/229 looks similar and perhaps more users are affected.
Can you maybe find out know how the RFC SDK landed at C:\Windows\System32 and C:\Windows\SysWOW64 ? These folders are apparently for 32 bit libraries on 64 bit system and it looks less likely the SDK is intentionally copied there?
If some recently installed package installed RFC SDK automatically, at these locations it would be good to find out which one.
Can you maybe find out know how the RFC SDK landed at C:\Windows\System32 and C:\Windows\SysWOW64 ?
I uninstalled almost every package (except SAP GUI) on the system in attempt to clean it up and none of the installers removed those files. it's possible it was an ad hoc manual action at some point in the past attempt to make something else work. At least this serves as a good troubleshooting knowledge base exemplar for the next poor soul that gets the equivalent of "check engine" light.
it's possible it was an ad hoc manual action at some point in the past attempt to make something else work.
Not sure about that. The same issue is reported on few other Windows notebooks with SAP standard Windows image, in issue #229. We suspect the error in installation procedure of some package and still investigate the root cause.
Is the Windows image on your notebook maybe a corporate/organization image? If yes, can you check if the same happens on some other notebook with SAP GUI installed?
@nikmalenovic
After checking more affected systems, the root cause is the collision of SAP Logon Client installation (SAPGUI) with node-rfc installation.
The standard node-rfc installation requires the latest SAP NWRFC SDK, copied to local folder and added to PATH.
SAP Logon Client also installs the SAP NWRFC SDK but in %WinSysDir%
, which is C:\Windows\system32
for 64-bit processes and C:\Windows\SysWoW64
for 32-bit processes. According to Windows DLL Search Order, these folders are searched first and when RFC SDK found there, the RFC SDK version on PATH does not matter, is not used.
The problem occurs when the RFC SDK version installed by SAPGUI is older than the version required for node-rfc and we try find out when and how that happens.
We collect more info from affected systems and it would help if you can send me:
C:\Windows\SysWoW64
folderPlease also check if only 32-bit 2013 VSC++ redistributable is installed. The 64-bit version (x64) must not be installed:
Please also check if only 32-bit 2013 VSC++ redistributable is installed. The 64-bit version (x64) must not be installed: ...
That's really problematic because ADT (ABAP Development Tools) require the x64 version of the 2013 VSC++ redistributable. I installed both (x32+x64) version of 2013 VSC++ on a fresh Windows 10, along with SAP NW RFC SDK, and fresh install of node 16 and eclipse 2021 with ADT tools, and it seems both eclipse (ABAP projects) and node-rfc (RFC calls from node) work like a charm. I do have SAP GUI 7.7 as well on this fresh system and yes, it did install the sapnwrfc.dll
in C:\Windows\SysWOW64
.
yes, both 32 and 64 bit redistributable must co-exist, removing one of them is not the solution. The issue on my test systems was something else and you use 64-bit Windows and 64-bit node, no need to install the 32-bit redistributable.
If I understand correctly, the re-installation of above mentioned packages fixed the issue?
Did you maybe re-installed or updated SAPGUI as well?
Please reopen if support still needed.
Describe the bug unable to execute installation test
node -p "require('node-rfc')"
.To Reproduce Windows 2012 R2 x64 (
Microsoft Windows [Version 6.3.9600]
). Installed Visual C++ redistributable 2013 x64. Installed SAP NW RFC SDK 7.50 (750 Patch Level 8
). Installed node.js LTS 14 (14.17.3
) along with tooling. TheSAPNWRFC_HOME
=c:\nwrfcsdk
. PATH hasc:\nwrfcsdk\lib
. The rfcexec (c:\nwrfcsdk\bin\rfcexec.exe
) runs without errors. Install node-rfc into global cache (npm -g i node-rfc
) followed by link to my current project (npm link node-rfc
). Executednode -p "require('node-rfc')"
Screenshots Install and error transcript:
Environment
node -p "require('node-rfc').environment"
- module won't loadAdditional context none