Open hakimio opened 2 hours ago
Hi,
Do you have the cds installed globally ?
Do you use mbt build
? or just the normal npm install
?
Yes, both cds env
and npx tsc
works normally and are installed globally.
Ok, looks like it's about Windows 10, have you tried on Windows 11
or latest version ?
strategy:
matrix:
version: [20, 18]
platform: [ubuntu-latest, windows-latest, macos-latest]
I am doing a strategy matrix and checking the following and for me worked, but I didn't checked on windows 10
Tested with just npm install
.
BTW, when running npx tsc
command manually, noticed that I have to add --skipLibCheck
. Otherwise I get missing mocha
dependency error from cds types.
No, I haven't checked on Windows 11.
You use tsc
for building the gen/srv/
?
can you try Deploy cds-ts-dispatcher
Which script/command exactly do you want me to try to run? "build:ts": "tsc"
? mbt build
?
The demo app doesn't compile right now because of CDS_ENV
:
npm run build:ts
> cds-ts-samples@1.0.0 build:ts
> tsc
srv/controller/cat-service/handler/BookHandler.ts:105:19 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
105 @Env<CDS_ENV>('requires.auth.users') users: any[],
~~~~~~~~~~~~~~~~~~~~~
Found 1 error in srv/controller/cat-service/handler/BookHandler.ts:105
Anyway, this is not very important for me personally. Just wanted to let you know. So, no rush. Feel free to look into this when you have time and access to Windows 10 machine.
Appreciate, like always your input ! :)
Ok, got it to work on Windows after some googling.
Turns out the trick is pretty simple. You just have to add shell: true
. Source: StackOverflow post.
Will you add the fix or should I do it?
BTW, there are some libraries which supposedly helps you avoid those kind of cross platform issues:
EDIT: might be a good idea to check both result.stderr
and result.error
for errors when deciding if command succeeded.
yes, I am having a look over cross-spawn :) Which option you've used the cross-spawn or shell: true ?
If you have time, you can create a PR defently :)
I only tested with shell: true
.
Ok, shell might be a problem on mac, or unix.
Then cross-spawn
could be a good option too.
ok, I will check cross-spawn
Thanks
Current behavior
Try to debug to see why the
postinstall
script doesn't correctly generateCDS_ENV
for me and doesn't compile it. Here is what I get on Windows 10:Command: cds Result:
Command: npx tsc Result:
Expected behavior
CDS_ENV
is generated and transpiled.Steps to reproduce
Try to install
cds-ts-dispatcher
on Windows.Environment
Additional Info
Getting this working is not a priority for me, but, if you have access to Windows machine, would be nice if this could fixed.