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

CDS Watch does not work in Business Application Studio

BTPDev
Explorer
0 Kudos
4,563

Hi community,

since this week we are facing a strange issue SAP Business Application Studio, but it worked before.

As soon we want to run the application with "cds watch" we receive:

[ERROR] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined at validateString (internal/validators.js:125:11) at Object.join (path.js:1147:7) at getPortsFile (/home/user/projects/MYPROJECT/node_modules/ports/index.js:63:15) at Object.<anonymous> (/home/user/projects/MYPROJECT/node_modules/ports/index.js:13:29) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17)

We checked the file MYPROJECT/node_modules/ports/index.js and detected, that it reads the default-environment.json and wants to have a path to a .cds-services.json.

My first thougt was, okay, let's just provide this path and create that file within my projects.

After doing this, cds watch runs without error but it runs, and runs, and runs in a endless loop.

As already mentioned, we didn't changed anything in our application. The issue still occured with the start of the week.

Also creating a completing new workspace, taking the project from GIT and trying cds watch runs into the same error. Does anybody have an idea? Is it an fault by SAP standard code, e.g. at the functions:

Received type undefined at validateString (internal/validators.js:125:11) at Object.join (path.js:1147:7)

Thanks in advance for your help!

Accepted Solutions (1)

Accepted Solutions (1)

BTPDev
Explorer
0 Kudos

Hi Gregor, thanks again.

Difference is, that we do use @sap/cds. Nevertheless, we did the following:

npm update updates 
npm install 

npm udate increase all version numbers in package.json, e.g. in our case also for the @sap/hana-client

--> We still received a few errors due to missing libraries. We added the libs

npm install cjs
npm install ports

Finally, it worked again. Thanks for your help!

Answers (2)

Answers (2)

Sadullah75
Participant

cds watch 
in my case, didn't work because of npm @sap/cds package version is old by default.
at CLI type this line of command
npm i  @sap/cds@~6

after that you can see the package.json to verify it's been updated. That's it again run the

cds watch

I hope it helps someone.

hagen_hennum
Participant
0 Kudos
Hi. Today 24-feb-2025, I had to execute 'npm i @SAP/cds@~8' to made 'cds watch' work.
gregorw
SAP Mentor
SAP Mentor

Did you run:

npm i

For your project?

BTPDev
Explorer
0 Kudos

yes, sure.

npm install lead to the following message:

New patch version of npm available! 6.14.6 -> 6.14.8 │ │ Changelog: https://github.com/npm/cli/releases/tag/v6.14.8 │ │ Run npm install -g npm to update!

I afterwards did npm install -g npm, but without success. Still the same error

gregorw
SAP Mentor
SAP Mentor

Try also:

npm i -g @sap/cds-dk

as unfortunately the version coming with BAS is quite old.