on 2022 Jul 09 6:37 AM
Hey all - with the new CDS 6 release, I am attempting to upgrade my project environment to Node 16 as recommended. I have everything working fine locally but when deploying to cloud foundry I ran into this error when running "npx cds run" to :
npm ERR! could not determine executable to run
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/matthewreddy/.npm/_logs/2022-07-09T05_14_51_704Z-debug-0.log<br>
I have narrowed down the difference to the presence of @sap/cds-dk v6.0.2 (devDependency) and @sap/cds v6.0.2 (regular dependency) by removing all node modules, fixing my local node to the exact release of Node that the CF nodejs buildpack runs (16.14.2) running a "--production" installation locally (as is done during remote deploy).
Previously, in cds 5.x.x and Node 12 this paradigm worked fine. "npx cds ..." would be recognized as a command supplied by @sap/cds. However, with cds 6.x.x it seems to require @sap/cds-dk to recognize the command.
My question - is this an intentional change? And if so, it seems like we would need both @sap/cds and @sap/cds-dk based on the docs: @sap/cds-dk for the CLI commands and @sap/cds for project usage (i.e. "let cds = require('@sap/cds-dk')". My original impression - from back in the CDS 3 days - was that @sap/cds-dk was meant for local development while the leaner, more direct @sap/cds was intended for production (remote) deployment.
Request clarification before answering.
For me it was related to a missing system link, my ./node_modules/bin did not contain a "cds" entry after doing "npm clean-install --production" (or --omit=dev), unless cds-dk was also included as a dependency, even thou sap/cds clearly has a "bin" property in it's package.json.
My workaround was to modify my script to call "npm rebuild" afterwards, then I don't have to include cds-dk into a dependency. Hope it helps someone else.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
that's exactly what happened to me as well.
However, as I'm deploying with a release pipeline and the cf cli with multiapps plugin, I'd need to ssh into the deployed container after deployment to run npm rebuild.
Have you by any chance figured out by now what the root cause was / is?
Thank you very much (I was close to pulling my hair out of my head :D)
Best regards
I've accepted this as the answer. My new start script is:
"start": "npm rebuild && npx cds run",
I still think this should only be considered a workaround - looking for a more permanent solution, but to be honest the symlink/bin/etc stuff is always a little over my head so I'm not sure what the right outcome is.
Please check the release notes:
https://cap.cloud.sap/docs/releases/jun23#use-cds-serve-as-start-script
and use cds-serve for productive start.
User | Count |
---|---|
59 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.