-
Notifications
You must be signed in to change notification settings - Fork 48
Description
In a generated app, you get a script/system_check.cr which helps to ensure your app is setup and bootstrapped properly in development before booting. (e.g. if you need yarn to run your app, then ensure yarn is installed before trying to boot the app).
However, speaking of yarn, there's an issue on Windows.
The system_check runs this
lucky_cli/src/web_app_skeleton/script/system_check.cr.ecr
Lines 14 to 16 in 0d67c0a
| if command_not_found "yarn" | |
| print_error "Yarn is not installed\n See https://yarnpkg.com/lang/en/docs/install/ for install instructions." | |
| end |
which checks for the existence of an executable yarn.
lucky_cli/src/web_app_skeleton/script/helpers/function_helpers.cr.ecr
Lines 20 to 22 in 0d67c0a
| def command_not_found(command : String) : Bool | |
| Process.find_executable(command).nil? | |
| end |
This find_executable method will automatically append .exe to whatever command you pass in
This means it's actually looking for yarn.exe which doesn't exist. When you install node and yarn, yarn (as well as some other node related commands like pnpm, etc...) are just shell scripts. Even if yarn is installed properly, this will fail.
An alternate way to solve this could be to just run yarn -v and then check $?. That value seems to return 0 on Linux and True on Windows. I'd assume Process.run("yarn -v").normal_exit? would work, but it does feel a little hacky. I'm open to other ideas if anyone has any.