SAP / node-rfc

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

Unable to run on Windows 10 #115

Closed gabenunez closed 4 years ago

gabenunez commented 4 years ago

Currently unable to get running on Windows 10.

I've ran through the steps listed here and keep running into the following error when I attempt to run my script.

Capture

I've went as far as downgrading Node to v8.16.1 (currently setup on a remote server and running successfully). Ran through my paths and uninstalled and reinstalling the package.

Any help would be super great!

bsrdjan commented 4 years ago

Did you test the SAP NWRFC SDK installation by running rfcexec.exe, like described in section Test ?

If installed correctly, the output should be like:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\bsrdjan>cd %SAPNWRFC_HOME%

C:\Tools\nwrfcsdk>cd bin

C:\Tools\nwrfcsdk\bin>rfcexec.exe
Error: Not all mandatory parameters specified
        Please start the program in the following way:
        rfcexec -t -a <program ID> -g <gateway host> -x <gateway service>
                -f <file with list of allowed commands> -s <allowed Sys ID>
The options "-t" (trace), "-f" and "-s" are optional.

C:\Tools\nwrfcsdk\bin>
gabenunez commented 4 years ago

@bsrdjan I can confirm that's the output I'm getting, log below.

Microsoft Windows [Version 10.0.18362.476]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\gnunez>cd %SAPNWRFC_HOME%

C:\nwrfcsdk>cd bin

C:\nwrfcsdk\bin>rfcexec.exe
Error: Not all mandatory parameters specified
        Please start the program in the following way:
        rfcexec -t -a <program ID> -g <gateway host> -x <gateway service>
                -f <file with list of allowed commands> -s <allowed Sys ID>
The options "-t" (trace), "-f" and "-s" are optional.

Below further optional parameters are listed. You can find their
documentation in sapnwrfc.ini:
-on_cce <0, 1, 2> (On Character Conversion Error)
-cfit (Conversion Fault Indicator Token - the substitute symbol used if on_cce=2)
-keepalive (Sets the keepalive option. Default is 0.)
-delta <0, 1> (default 1, i.e. use delta-manager)
-no_compression (table compression, default is 0, i.e. compression is on)
bsrdjan commented 4 years ago

SAP NWRFC SDK is correctly installed. Could you please uninstall the node-rfc from your project, run the npm install node-rfc again and post the installation log?

gabenunez commented 4 years ago

@bsrdjan Please see below.

PS C:\Users\gnunez\projects\ebayfeed\tracking> npm i node-rfc

> node-rfc@1.0.3 preinstall C:\Users\gnunez\projects\ebayfeed\node_modules\node-rfc
> npm install cmake-js prebuild-install prebuild node-addon-api

npm notice created a lockfile as package-lock.json. You should commit this file.
+ node-addon-api@1.7.1
+ prebuild-install@5.3.3
+ cmake-js@5.3.2
+ prebuild@9.1.1
added 245 packages from 209 contributors and audited 1205 packages in 14.807s
found 0 vulnerabilities

> node-rfc@1.0.3 install C:\Users\gnunez\projects\ebayfeed\node_modules\node-rfc
> prebuild-install --tag-prefix -r napi || npm run prebuild

npm WARN apitodb@1.0.0 No repository field.

+ node-rfc@1.0.3
added 2 packages from 45 contributors and audited 2513 packages in 20.363s
found 0 vulnerabilities
bsrdjan commented 4 years ago

All looks correct, the package downloaded from npm, no build from source. Just tested in VS2019 and x86 Power Shells and all works:

PS C:\src\test>  node -e "console.log(require('node-rfc'))"
{ Client: [Function: Client], Pool: [Function: Pool] }

Which node version are you using and what is the output of node -e "console.log(process.arch)" ?

gabenunez commented 4 years ago

@bsrdjan I was originally on v8.16.1, but just re-upgraded to the latest v12.13.1.

Running that returns x64.

bsrdjan commented 4 years ago

Tried again with node 12.13.1 and could not reproduce.

Could you please check if all files present in node_modules\node-rfc\lib folder, like:

Screenshot 2019-12-09 at 11 59 58

What happens if sapnwrfc.node requested directly:

cd node_modules\node-rfc\lib\binding
node -e "console.log(require('.\sapnwrfc.node'))"
gabenunez commented 4 years ago
C:.
│   index.d.ts
│   index.js
│   index.js.map
│   
├───binding
│       sapnwrfc.node
│       
└───wrapper
        sapnwrfc-client.d.ts
        sapnwrfc-client.js
        sapnwrfc-client.js.map
        sapnwrfc-pool.d.ts
        sapnwrfc-pool.js
        sapnwrfc-pool.js.map

Looks like files are present.

Oddly enough, when I request it directly it can not find the module.

PS C:\Users\gnunez\projects\ebayfeed\node_modules\node-rfc\lib\binding> node -e "console.log(require('sapnwrfc.node'))"
internal/modules/cjs/loader.js:800
    throw err;
    ^

Error: Cannot find module 'sapnwrfc.node'
Require stack:
- C:\Users\gnunez\projects\ebayfeed\node_modules\node-rfc\lib\binding\[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at require (internal/modules/cjs/helpers.js:74:18)
    at [eval]:1:13
    at Script.runInThisContext (vm.js:116:20)
    at Object.runInThisContext (vm.js:306:38)
    at Object.<anonymous> ([eval]-wrapper:9:26)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at evalScript (internal/process/execution.js:80:25) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\gnunez\\projects\\ebayfeed\\node_modules\\node-rfc\\lib\\binding\\[eval]'
  ]
}
PS C:\Users\gnunez\projects\ebayfeed\node_modules\node-rfc\lib\binding> node -e "console.log(require('.\sapnwrfc.node'))"
internal/modules/cjs/loader.js:800
    throw err;
    ^

Error: Cannot find module '.sapnwrfc.node'
Require stack:
- C:\Users\gnunez\projects\ebayfeed\node_modules\node-rfc\lib\binding\[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at [eval]:1:13
    at Script.runInThisContext (vm.js:116:20)
    at Object.runInThisContext (vm.js:306:38)
    at Object.<anonymous> ([eval]-wrapper:9:26)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at evalScript (internal/process/execution.js:80:25) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\gnunez\\projects\\ebayfeed\\node_modules\\node-rfc\\lib\\binding\\[eval]'
  ]
}
bsrdjan commented 4 years ago

With double backslash should work, like:

 node -e "console.log(require('.\\sapnwrfc.node'))"

Which VC redistributable is installed?

gabenunez commented 4 years ago

Thar seems to have went further.

PS C:\Users\gnunez\projects\ebayfeed\node_modules\node-rfc\lib\binding> node -e "console.log(require('.\\sapnwrfc.node'))"       
internal/modules/cjs/loader.js:1025
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The specified procedure could not be found.
\\?\C:\Users\gnunez\projects\ebayfeed\node_modules\node-rfc\lib\binding\sapnwrfc.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1025:18)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at [eval]:1:13
    at Script.runInThisContext (vm.js:116:20)
    at Object.runInThisContext (vm.js:306:38)
    at Object.<anonymous> ([eval]-wrapper:9:26)
    at Module._compile (internal/modules/cjs/loader.js:959:30)

I just removed all previous versions of VC redistributable and installed the version listed here. I'm currently on 14.0.23026.0

Berdmanfolk commented 4 years ago

I have the same error on windows 10

drgif commented 4 years ago

I am getting the same error on Windows 10 for a few weeks now too, but I am able to run on Windows Server 2012 R2 Standard. I have tried a couple of combinations:

The issue on my Windows 10 Enterprise could well have started around the time I installed Creators Update. Maybe it has something to do with that? If you need more information or would like me to try other configurations, I will do my best to provide them.

Oh, and I cannot reproduce the result from @gabenunez two posts ago on my Windows 10 machine (haven't tried on the others).

Thank you so much for looking into this!

drgif commented 4 years ago

Ok, I fixed it for our machines and it seems like there were two problems:

Installing the VC++ 2013 Redistributable from the Microsoft Website fixed the problem.

fredimartins commented 4 years ago

see this https://github.com/SAP/node-rfc/issues/119

bsrdjan commented 4 years ago

Solution documented in https://github.com/SAP/node-rfc/issues/119#issuecomment-593379516, will update the README well