We are trying to use latest version of "@sap/cds-odata-v2-adapter-proxy" : "^9.1.15" with "@sap/cds": "^6.3.1", in one of our sap CAP project and while trying to deploy the MTA we are getting the following error
"Cannot find module '@sap/cds-odata-v2-adapter-proxy'

And the output of the command cds version in terminal
@sap/cds: 6.3.1
@sap/cds-compiler: 3.4.2
@sap/cds-dk: 6.3.1
@sap/cds-foss: 4.0.0
@sap/cds-mtx: -- missing --
@sap/cds-odata-v2-adapter-proxy: 1.9.15
@sap/eslint-plugin-cds: 2.6.0
Node.js: v16.16.0
home: /home/user/projects/proj-hcl-forecastplan-sol/node_modules/@sap/cds
proj-hcl-forecastplan-sol: 1.0.0<br>
The current versions in mta.yml
"dependencies": {
"@sap-cloud-sdk/core": "^1.54.2",
"@sap/cds": "^6",
"@sap/cds-odata-v2-adapter-proxy": "^1.9.15",
"date-and-time": "^2.4.0",
"express": "^4",
"hdb": "^0.18.3",
"mbt": "^1.2.18",
"passport": "^0.6.0"
},
"devDependencies": {
"3": "^2.1.0",
"@sap/ux-specification": "^1.96.16",
"sqlite": "^4.1.1",
"sqlite3": "^5.1.2"
},
Request clarification before answering.
Hi aakash_n,
Sorry, I asked you the wrong file. The one I need to see is the mta.yaml.
Anyway, check if you have the following configuration on your nodejs module:
build-parameters:
ignore: ["package-lock.json", "node_modules/"]
If you have doubts how to include this directive, check the following example:
https://github.com/SAP-samples/cap-sflight/blob/main/mta.yaml
Then add a file .npmrc file on them with the following:
registry=https://registry.npmjs.com/
Once this is done, your mtar file will be much smaller than how it is right now because all node modules will be installed during deploy time. The .npmrc file is needed so CF is able to retrieve the modules directly from internet.
Hope this solves your problem.
Best regards,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ivan.mirisola,
I have tried the solution mentioned above i.e we have included the ignore parameter in the mta.yaml file as shown.
_schema-version: '3.1'
ID: hcl-forecastplan
version: 1.0.0
description: Forecast Plan (Rel20221117)
parameters:
enable-parallel-deployments: true
build-parameters:
before-all:
- builder: custom
commands:
- npm ci
- npx -p @sap/cds-dk cds build --production
modules:
- name: hcl-forecastplan-srv
type: nodejs
path: gen/srv
parameters:
buildpack: nodejs_buildpack
memory: 400M
disk-quota: 400M
build-parameters:
builder: npm-ci
ignore: ["package-lock.json", "node_modules/"]
provides:
- name: srv-api
properties:
srv-url: '${default-url}'
requires:
- name: com-hcl-forecastplan-db
- name: com-hcl-forecastplan-destination
- name: com-hcl-forecastplan-uaa
- name: com-hcl-forecastplan-conectivity
- name: hcl-forecastplan-db-deployer
type: hdb
path: gen/db
parameters:
buildpack: nodejs_buildpack
memory: 300M
disk-quota: 300M
build-parameters:
ignore: ["package-lock.json", "node_modules/"]
requires:
- name: com-hcl-forecastplan-db
- name: com-hcl-forecastplan-destination
- name: com-hcl-forecastplan-uaa
- name: com-hcl-forecastplan-conectivity
resources:
- name: com-hcl-forecastplan-db
type: com.sap.xs.hdi-container
parameters:
service: hana
service-plan: hdi-shared
properties:
hdi-service-name: '${service-name}'
- name: com-hcl-forecastplan-destination
type: org.cloudfoundry.managed-service
parameters:
service-name: com-hcl-forecastplan-destination
service: destination
service-plan: lite
- name: com-hcl-forecastplan-uaa
type: org.cloudfoundry.managed-service
parameters:
path: ./xs-security.json
service: xsuaa
service-plan: application
config:
xsappname: 'hcl-forecastplan-${space}'
tenant-mode: dedicated
- name: com-hcl-forecastplan-conectivity
type: org.cloudfoundry.managed-service
parameters:
service: connectivity
service-plan: lite
service-name: com-hcl-forecastplan-conectivity
I have also Included a .npmrc file in the root directory of the project.
@sap:registry=https://registry.npmjs.org/
registry=https://registry.npmjs.org/
But again, when we deploy the code, we get the same error as below in the logs/
[ERROR] Cannot find module '@sap/cds-odata-v2-adapter-proxy' (STDERR, APP/PROC/WEB)#
I have uploaded the logs.
hcl-forecastplan-db-deployer.txt
can you please help.
Hi aakash_n,
I couldn't reproduce the errors you are facing on by BTP account.
I've noticed you have added the file npmrc at the project root. However, I would've added it at module level as well.
Plus, since your deployment has failed, I would abort that deployment and delete all itens created by it. You can do it manually via Cockpit or you can use the command 'CF UNDEPLOY' which allows you to delete all keys and services with it.
cf undeploy hcl-forecastplan --delete-service-keys --delete-services -f
Once you have it all clean on your subaccount/space, then try to redeploy it.
BTW: This shoudn't have anything to do with the issue at hand, but there is a newer version of COV2AP:
"@sap/cds-odata-v2-adapter-proxy": "^1.9.15",
Best regards,
Ivan
Hi ivan.mirisola,
I tried the same as mentioned
Included the .npmrc at module level.
and we are using the latest version 1.9.15 of @sap/cds-odata-v2-adapter-proxy
{
"name": "proj-hcl-forecastplan-sol",
"version": "1.0.0",
"description": "Forecast Plan (Rel20221117)",
"repository": "<Add your repository here>",
"license": "UNLICENSED",
"private": true,
"dependencies": {
"@sap-cloud-sdk/core": "^1.54.2",
"@sap/cds": "^6",
"@sap/cds-odata-v2-adapter-proxy": "^1.9.15",
"date-and-time": "^2.4.0",
"express": "^4",
"hdb": "^0.18.3",
"mbt": "^1.2.18",
"passport": "^0.6.0"
},
"devDependencies": {
"3": "^2.1.0",
"@sap/ux-specification": "^1.96.16",
"sqlite": "^4.1.1",
"sqlite3": "^5.1.2"
}We Aborted the deployment and deleted all items created by it using the mentioned command 'CF UNDEPLOY'.
Still The deployment process is getting failed and when we are checking the dmol logs, we are seeing the same error
"[ERROR] Cannot find module '@sap/cds-odata-v2-adapter-proxy' (STDERR, APP/PROC/WEB) #"
I have attached the logs
Regards,
Aakash
Hi aakash_n,
Can you please share your "srv/server.js" as well.
Also, even after you have a failed deployment on BTP, you still have your srv app deployed with a failed state.
Go there and fetch the app logs as well.
In parallel, I would encourage you to open a ticket at SAP Support system as it might be a new issue that I am not aware of.
Best regards,
Ivan
Hi ivan.mirisola,
Please find the logs of srv module,
I'm sorry we can't share the project source.
hcl-forecastplan-srv-2022-11-23-12-56-163210000.txt
Regards,
Aakash
Hi aakash_n,
With the same mta.yaml and package.json, my account produced the following output:
2022-11-22T12:49:34.454+0000 [STG/0] OUT Installing node modules (package.json)
2022-11-22T12:49:43.184+0000 [STG/0] OUT > [email protected] install /tmp/app/node_modules/mbt
2022-11-22T12:49:43.184+0000 [STG/0] OUT > binwrap-install
2022-11-22T12:49:44.039+0000 [STG/0] OUT added 283 packages from 367 contributors and audited 469 packages in 9.204s
As you can see, the deploy process has produced an srv app on BTP with 283 packages.What I don't see in your log file is the same lines where mbt does the installation of node modules:2022-11-23T12:45:55.290+0000 [STG/0] OUT Installing node modules (package.json)
2022-11-23T12:46:01.897+0000 [STG/0] OUT added 72 packages, and audited 73 packages in 6s
2022-11-23T12:46:01.897+0000 [STG/0] OUT 9 packages are looking for funding
Please check that you are building the mtar file with the latest version of mbt:npm i -g mbt@latest
I have also noticed that on my srv module BTP determines that it has to load node version 14:2022-11-22T12:49:32.594+0000 [STG/0] OUT Downloading app package...
2022-11-22T12:49:32.631+0000 [STG/0] OUT Downloaded app package (1.9K)
2022-11-22T12:49:32.720+0000 [STG/0] OUT -----> Nodejs Buildpack version 1.8.0
2022-11-22T12:49:32.720+0000 [STG/0] OUT -----> Installing binaries
2022-11-22T12:49:32.721+0000 [STG/0] OUT engines.node (package.json): ^14.18.0
2022-11-22T12:49:32.721+0000 [STG/0] OUT engines.npm (package.json): unspecified (use default)
2022-11-22T12:49:32.721+0000 [STG/0] OUT -----> Installing node 14.20.0
However, in your case, I see node 16 is being loaded:2022-11-23T12:45:53.361+0000 [STG/0] OUT Downloading app package...
2022-11-23T12:45:53.407+0000 [STG/0] OUT Downloaded app package (38.8K)
2022-11-23T12:45:53.512+0000 [STG/0] OUT -----> Nodejs Buildpack version 1.8.0
2022-11-23T12:45:53.514+0000 [STG/0] OUT -----> Installing binaries
2022-11-23T12:45:53.514+0000 [STG/0] OUT engines.node (package.json): ^16
2022-11-23T12:45:53.514+0000 [STG/0] OUT engines.npm (package.json): unspecified (use default)
2022-11-23T12:45:53.514+0000 [STG/0] OUT -----> Installing node 16.17.0
However, I suppose that BAS has version 14 installed and CDS modules are still being built on top of version 14. Version 16 shouldn't break your app, but I cannot say that it would affect the installation of modules during deployment.I suggest adding the specific node version to your package.json so BTP is able to install the same version you are using on BAS: "engines": {
"npm": ">=9.0.0",
"node": ">=14.0.0 <16.0.0"
},
Best regards,Ivan
Hi ivan.mirisola,
Thanks for the reply,
I have Updated the mbt to the latest version

and also included the node versions to all package.json files in every module of the project
{
"name": "proj-hcl-forecastplan-sol",
"version": "1.0.0",
"description": "Forecast Plan (Rel20221124)",
"repository": "<Add your repository here>",
"license": "UNLICENSED",
"private": true,
"dependencies": {
"@sap-cloud-sdk/core": "^1.54.2",
"@sap/cds": "^6.3.2",
"@sap/cds-odata-v2-adapter-proxy": "^1.9.15",
"date-and-time": "^2.4.0",
"express": "^4.18.2",
"hdb": "^0.19.5",
"mbt": "^1.2.20",
"passport": "^0.6.0"
},
"devDependencies": {
"3": "^2.1.0",
"@sap/ux-specification": "^1.96.16",
"sqlite": "^4.1.2",
"sqlite3": "^5.1.2"
},
"engines": {
"npm": ">=9.0.0",
"node": ">=14.0.0 <16.0.0"
},But we are still getting the same error while deploying the mtar to the Btp
Also while we are doing the "npm update" we are getting the following message everytime

Regards,
Aakash.
Log Files:
Hi aakash_n,
Apparently BAS is using a newer NodeJS version (version 16 instead of 14).
I had warnings on different modules (cds-dk dependencies) while using version 16 on my desktop - therefore I switched back to version 14, where I have no warnings at all.
Would it be possible for you to compile this project on a desktop machine?
Also, could you connect to your srv cell via SSH protocol and inspect the files to see if the module is really there?
https://blogs.sap.com/2018/09/12/ssh-into-cloudfoundry-trouble/
C:\node-wksp\mycap>cf apps
Getting apps in org isv / space dev as ivan
OK
name requested state instances memory disk urls
hcl-forecastplan-srv started 1/1 400M 400M hcl-forecastplan-srv.cfapps.us10.hana.ondemand.com
C:\node-wksp\mycap>cf enable-ssh hcl-forecastplan-srv
Enabling ssh support for 'hcl-forecastplan-srv'...
OK
C:\node-wksp\mycap>cf restart hcl-forecastplan-srv
Restarting app hcl-forecastplan-srv in org isv / space dev as ivan
Stopping app...
Waiting for app to start...
name: hcl-forecastplan-srv
requested state: started
routes: hcl-forecastplan-srv.cfapps.us10.hana.ondemand.com
last uploaded: Thu 24 Nov 10:49:10 -03 2022
stack: cflinuxfs3
buildpacks: nodejs
type: web
instances: 1/1
memory usage: 400M
start command: npm start
state since cpu memory disk details
#0 running 2022-11-28T14:29:18Z 0.0% 4.4M of 400M 171.7M of 400M
C:\node-wksp\mycap>cf ssh hcl-forecastplan-srv
vcap@c8b17ebe-ec8e-4e4b-5140-177d:~$ <------------- this line indicates you are on your cloud foundry cell
Here, pay attention to the disk usage. You have specified 400M storage on your MTA definition, but your srv module could more then 400M storage. If it is reaching close to 400M, then it would be wise to increase this value.
Once you are on your srv cell, then you can inspect its structure by issuing linux commands. For example:
vcap@c8b17ebe-ec8e-4e4b-5140-177d:~$ cd ~/deps/0/node_modules/@sap
vcap@c8b17ebe-ec8e-4e4b-5140-177d:~/deps/0/node_modules/@sap$ ll
total 12
drwxr-xr-x 8 vcap vcap 113 Nov 24 13:49 ./
drwxr-xr-x 254 vcap vcap 8192 Nov 24 13:49 ../
drwxr-xr-x 10 vcap vcap 207 Nov 24 13:48 cds/
drwxr-xr-x 6 vcap vcap 124 Nov 24 13:48 cds-compiler/
drwxr-xr-x 2 vcap vcap 94 Nov 24 13:48 cds-foss/
drwxr-xr-x 3 vcap vcap 89 Nov 24 13:48 cds-odata-v2-adapter-proxy/
drwxr-xr-x 4 vcap vcap 172 Nov 24 13:48 xsenv/
drwxr-xr-x 4 vcap vcap 100 Nov 24 13:48 xssec/
Here we can clearly see that the module was installed at '/home/deps/0/node_modules/@sap' or at its limlink here '/home/vcap/app/node_modules/@sap'
Best regards,
Ivan
Hi ivan.mirisola,
Thanks For the reply.
Due to a suggestion, we removed package.json and the node_modules from the srv and app folder and maintained it in the project root folder.
Which resulted in successful deployment of the mta to the BTP without the common error which we are facing before.
here is the structure:

But we are Facing an Issue:
when we access the srv in the local mode, we are getting this below error:
It's the same error we are getting in the deployed fiori app.
<error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
<code>502</code>
<message>Error during request to remote service: Cannot find module '@sap-cloud-sdk/http-client' Require stack: - /home/user/projects/proj-hcl-forecastplan-sol/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js - /home/user/projects/proj-hcl-forecastplan-sol/node_modules/@sap/cds/libx/_runtime/remote/Service.js - /home/user/projects/proj-hcl-forecastplan-sol/node_modules/@sap/cds/lib/index.js - /home/user/projects/proj-hcl-forecastplan-sol/node_modules/@sap/cds/bin/cds.js - /extbin/npm/globals/lib/node_modules/@sap/cds-dk/bin/cds.js - /extbin/npm/globals/lib/node_modules/@sap/cds-dk/bin/watch.js</message>
</error>we are unable find Solution for the error, Please help.
Regards,
AakashHi aakash_n,
That makes sense. CAP doesn't require a package.json on the srv module. I wasn't aware you had it there - one more reason why I requested to take a look at the project via git. My CAP project was scaffolded with 'cds init', so I don't have a package file under the srv module.
Anyway, I am glad that you've found a solution.
My suggestion is that you open a new question for the Cloud SDK issue. Because that way other collaborators will be able to take a look at this particular new issue. Not to mention the fact that the question will be easier for others to find a solution when facing the same issue.
Best regards,
Ivan
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.