cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How-to use CDS 7 and Node.js 18 required by CAP in BAS ?

Attila
Active Participant
0 Likes
9,627

Dear BAS wizards,

I added cds 7 as dependency and cds-dk 7 as devdependency, but when I try to issue cds commands in a brand new BAS CAP workspace, I'm getting this error:

This application uses @sap/cds version >= 7, which is not compatible with the installed @sap/cds-dk version 6. Either update @sap/cds-dk to version 7 or downgrade @sap/cds to version 6 instead.

...

at build (/extbin/globals/pnpm/5/.pnpm/registry.npmjs.org+@sap+cds-dk@6.8.2/node_modules/@sap/cds-dk/bin/build/all.js:75:30)

This affects the built-in features as well

cds -v dumps the following

@sap/cds: 7.0.3
@sap/cds-compiler: 3.9.4
@sap/cds-dk: 6.8.2
@sap/cds-foss: 4.0.2
@sap/cds-mtx: -- missing --
@sap/cds-mtxs: 1.8.4
@sap/eslint-plugin-cds: 2.6.3
@sap/hana-client: 2.17.21
@sap/hdi-deploy: 4.7.1
@sap/xsenv: 3.4.0
MonitoringCockpitBS: 0.0.1
Node.js: v16.19.0
home: /extbin/globals/pnpm/5/.pnpm/registry.npmjs.org+@sap+cds@6.8.4/node_modules/@sap/cds

It seems 6.8.4 is used in BAS as external binary. Can I switch the version like like setting home to 7.0.2, which is also available in the

/extbin/globals/pnpm/5/.pnpm/

folder ?

With the June update CAP also recommends to use Node.js 18 because 16 is out of minatenance in 1 month. How can we use Node.js 18 in brand new BAS dev spaces, to follow SAP recommendadtions?
There are posts to do update by ourself or against to do it...

package-lock.json were deleted node modules wiped and completely renstalled in the projects.
Some references also checked about side-effects of release changes previously.
https://answers.sap.com/questions/13674288/cds-6-btp-cf-deployment.html

But none of them helped.
Workaround which makes cds serve working, but not cds build:
Moving cds-dk from devdependencies to dependencies in package.json helped, combined with npm rebuild command. But not sure we need cds-dk in production...

Also noticed after tegh above workaround that during cds serve the following that multiple cds versions detected:

As recommended in CAP June update I've added the new separate packages as dependency:

"@sap/cds": "^7",

"@sap/cds-common-content": "^1.2.0",

"@sap/cds-fiori": "^1.0.0",

"@sap/cds-hana": "^2.0.0",

"@sap/cds-foss": "^3.1",

Thank You

Attila

Accepted Solutions (1)

Accepted Solutions (1)

licam_oved
Product and Topic Expert
Product and Topic Expert

Hello,

You can change the globally installed version by executing npm install -g @sap/cds-dk@<required version>

Regarding Node 18, currently there's no way to change the Node version used in BAS.

The team is working on upgrading to Node 18.

BR,
Licam

Attila
Active Participant

Thank You licam.oved,
now I have the right versions, project is back online 🙂

I should have done something wrong before. I've tried to install it previously, but @sap/cds-dk entries showed me still 6.84.

Let's wait patiently for Node.js 18 :).

Thanks again

Best regards
Attila

licam_oved
Product and Topic Expert
Product and Topic Expert

Thanks for the update!

Sometimes you need to open a new Terminal after new version installation because the current Terminal doesn't catch it (same can happen on local PC).

chgeo
Product and Topic Expert
Product and Topic Expert

Note that CDS 7 does not require Node.js 18, but still runs with Node.js 16.

Attila
Active Participant
0 Likes

Thank You!
I've just wanted to follow SAP recommendation 🙂

BR,Attila

Answers (2)

Answers (2)

licam_oved
Product and Topic Expert
Product and Topic Expert
0 Likes

Anyone reading this thread, please note that the Node version in BAS is being continuously updated.
Today the Node version is 20.
Also, as of November 2023 BAS also support changing the runtime version of Node. See more here.

sandeep_suggu
Contributor
0 Likes
Attila
Active Participant
0 Likes

How this supposed to be change the Node.js runtime delivered with BAS Development Space Containers ? This is a YeoMan generator template.