Closed finkmanAtSap closed 3 months ago
Hi, it looks like an inconsistency in your local setup. You are using cds-dk 8.1.0 with cds 8.0.4:
cds-dk [8.1.0], cds [8.0.4], compiler [5.0.6], home [/Users/myUserName/Code/Git/workspace_cap_ams_nodejs/node_modules/@sap/cds]
I don't think this is a valid combination. On my machine it looks like this:
cds-dk [8.1.0], cds [8.1.0], compiler [5.1.0], home [/Users/d032842/.npm/_npx/90ef89323fd5c40d/node_modules/@sap/cds-dk/node_modules/@sap/cds]
Please delete the folder node_modules
and the file package-lock.json
from your local project folder and re-try.
I was not able to reproduce with current main branch.
Thanks,
Markus
Thanks for your super fast help! I can confirm that it works fine for me when I clone it into a different folder that is not an NPM workspace.
But unfortunately, I cannot get the sample working inside my NPM workspace where I would like to install/link our cds build/add
plugin to develop against a Java project.
I updated my versions but it still does not work:
cds-dk [8.1.0], cds [8.1.0], compiler [5.1.0]
Also,
npm i --workspaces false
says it is adding 1 package but I still cannot see any node_modules folder or package-lock.json inside the local project folder. As there is no package.json in this projec, it feels like there is some internal npm commands going on inside maven that I have no control over that does not like to run inside an npm workspace?
I guess your setup broke with our changes we did here: https://github.com/SAP-samples/cloud-cap-samples-java/commit/ad8222acebb47285c30a83b02d0116634b7a2515
We now use an approach where we use npx --package
to execute cds build commands. This doesn't require node_modules or package.json in the project.
However I think in a workspace setup you will not want to manage the cds-dk version via the Java build, but via the workspace's package.json. My suggestion would be to remove the property cds.cdsdk-version
from the pom.xml
. In that case the npx
command should pick up the cds-dk from the workspace's node_modules.
You will most likely need to add @sap/cds-mtxs
to the workspace's package.json
as well (or to a package.json
in the bookshop project).
Thanks, I can confirm that the app runs fine when I follow your suggestions:
cds.cdsdk-version
from the pom.xml
@sap/cds-mtxs
after installing @sap/hana-client
which is a mandatory peer dependency of it that could not be found in my workspaceFor reference, my workspace's package.json
looked like this afterwards:
{
"workspaces": [
"./*"
],
"dependencies": {
"@sap/cds-mtxs": "^2.0.5-2024080608494642-release-SNAPSHOT",
"@sap/hana-client": "^2.21.28"
}
}
👍
An alternative to adding the dependencies to the workspace's package.json might also be to include the mtx/sidecar
from the bookshop project into the workspaces in addition (which already defines these dependencies).
I have cloned the repository with all prerequisites installed but when I run
mvn spring-boot:run
, I get the following error which does not disappear when I try to runnpm install
.