Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node v20.12.2 breaks windows CLI #1376

Closed
arthurfiorette opened this issue Apr 16, 2024 · 12 comments
Closed

Node v20.12.2 breaks windows CLI #1376

arthurfiorette opened this issue Apr 16, 2024 · 12 comments
Labels
needs more info stale No recent activity.

Comments

@arthurfiorette
Copy link

https://nodejs.org/en/blog/release/v20.12.2#2024-04-10-version-20122-iron-lts-rafaelgss

nodejs/node@69ffc6d50d disabled execution of .cmd and .bat files with child_process.spawn, which breaks oclif's dev.cmd and bin.cmd scripts to be run on windows.

@arthurfiorette
Copy link
Author

I managed to fix it by simply removing both .cmd files. I'm not sure if they previously served a specific purpose or were just there to simplify compatibility with Windows; more information is needed.

Here's the PR if someone wants

@mdonnalley
Copy link
Contributor

mdonnalley commented Apr 16, 2024

@arthurfiorette can you elaborate on what's not working? Is it that windows users aren't able to execute bin/dev.cmd and bin/run.cmd locally? Or is it that the windows installer (created by oclif pack win) doesn't work?

@drewbitt
Copy link

Also 18.20.2 and 21.7.3

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale No recent activity. label May 17, 2024
@arthurfiorette
Copy link
Author

not stale

@mdonnalley
Copy link
Contributor

@arthurfiorette if it's not stale, can you answer my original question:

can you elaborate on what's not working? Is it that windows users aren't able to execute bin/dev.cmd and bin/run.cmd locally? Or is it that the windows installer (created by oclif pack win) doesn't work?

@arthurfiorette
Copy link
Author

Oh sorry!

After node v20.12.2, nodejs enable execution of .cmd files only under a flag. This means that all package managers (npm, yarn, pnpm...) also cannot execute .cmd. I didn't testes with the oclif pack win command, but locally it cannot be executed.

You can simply test this out by switching to v20.12.2+ and creating a new CLI.

@mdonnalley
Copy link
Contributor

@arthurfiorette how are you running the .cmd files?

I'm not able to repro with these steps

  • install node 20.12.2
  • oclif generate my-cli
  • cd my-cli
  • bin\dev.cmd hello world

My understanding of the node change is that it only applies to spawning .cmd and .bat but there's no where in newly generated CLIs where we spawn the .cmd files.

@arthurfiorette
Copy link
Author

I'm not running directly, users in Windows complain about this problem when they run our CLI with npx cli ....

@mdonnalley
Copy link
Contributor

@arthurfiorette What kind of fix do you have in mind here? I don't think there's anything addressable here since we're just providing the .cmd files - it's other people's responsibility to use them correctly

@arthurfiorette
Copy link
Author

In windows, when there's a dev.js and dev.cmd, the cmd file is preferred over the .js, so it will break forever until we start shipping new versions without the .cmd files.

@mdonnalley
Copy link
Contributor

I'm struggling to see how this is a fix that needs to happen in oclif and not in your CLI. Simply removing the .cmd files from oclif generate would have downstream consequences on oclif pack win, which depends on those files. So my perspective is that if your use case doesn't need them or can't use them, then you can delete easily them in your CLI.

I'm closing this for now unless you can prove that this isn't an issue specific to your CLI

@mdonnalley mdonnalley closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info stale No recent activity.
Projects
None yet
Development

No branches or pull requests

3 participants