Closed Franco-Figueredo closed 2 years ago
What are exactly the installation steps? This sounds wrong:
Download it using InvokeWebrequest (https://github.com/SAP/node-rfc/issues/166#issuecomment-681901627) and then change directory to node-rfc-main. There, use npm install
The npm install
will install node-rfc dependencies and rebuild the node-rfc. It will not install it on your system or project.
It should be:
Download it using InvokeWebrequest (https://github.com/SAP/node-rfc/issues/166#issuecomment-681901627) and then change directory to working directory (where the package.json is) and use
npm install /path/to/node-rfc-main
or the node-rfc can be installed globally: npm -g install /path/to/node-rfc-main
Here one working ubuntu docker, as a reference: https://github.com/SAP/fundamental-tools/blob/main/docker/ubuntu-qa.Dockerfile
The installation steps are (locally and directly from Visual Studio Code, not in docker):
1- Download the master branch and unzip it to 'node-rfc-master' folder.
2- I run the command npm install /path/to/node-rfc-master
and the installation runs without problems.
3- I try to run index.js with this line const node_rfc = require('node-rfc');
but I get the error Error: Cannot find module '../binding/sapnwrfc'
posted above.
Could you please share the package.json
?
Sure. Here it is:
{
"name": "nodejsap",
"version": "1.0.0",
"description": "Add your description here",
"main": "index.js",
"scripts": {
"serve": "node ./node_modules/nodemon/bin/nodemon index.js"
},
"repository": {
"type": "git",
"url": "<url>/nodejsap.git"
},
"keywords": [
"nodejs",
"express"
],
"author": "Franco",
"license": "ISC",
"dependencies": {
"express": "^4.16.4",
"morgan": "^1.10.0",
"node-rfc": "file:node-rfc-main"
},
"devDependencies": {
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^17.0.0-0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^6.0.0",
"nodemon": "^2.0.15",
"prettier": "^2.5.1"
}
}
I reproduced and need to investigate the root cause. This workaround works on my system:
mkdir test
npm init -y
# install node-rfc outside of project folder, like one level below
cd ..
git clone https://github.com/SAP/node-rfc.git node-rfc-main
cd node-rfc-main
npm install
# add to project and test
cd ../test
npm install ../node-rfc-main
node -p "require('node-rfc')"
package.json
{
"name": "nrfc",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"node-rfc": "file:../node-rfc-main"
}
}
Worked perfectly following your steps.
Thank you, @bsrdjan !
Its worked. Thank you, Mr.Srdjan Boskovic
Describe the bug "MODULE_NOT_FOUND" error when trying to execute some SAP Function Module such as
RFC_TRANSACTION_CALL
.To Reproduce Install node-rfc locally, not from npm. Download it using InvokeWebrequest (https://github.com/SAP/node-rfc/issues/166#issuecomment-681901627) and then change directory to node-rfc-main. There, use
npm install
.Screenshots Took this screenshot to show that everything's installed correctly. Ran all the commands listed here: https://github.com/SAP/node-rfc/blob/main/doc/installation.md
Environment
Additional context Full error when running the script to execute some SAP Function Module such as
RFC_TRANSACTION_CALL
:My script has the requirement of node-rfc the following way:
const addon = require('./noderfc-master/node-rfc-main/lib/index');