aspect-build / aspect-build/rules_js
Cryptic build error on Windows without a usable bash.exe
- Dominant language
- Starlark
- Stars
- 378
- Forks
- 183
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 29
Description
Using `v.1.0.0` on Windows without having a `bash.exe` / `msys` installed gives a cryptic build error:
```
ERROR: C:/users/XXXX/desktop/XXX/projects/support/icon-converter/BUILD.bazel:5:22: Running lifecycle hooks on npm package source-map@0.6.1 failed: (Exit 1): lifecycle-hooks.bat failed: error executing command bazel-out\x64_windows-opt-exec-5360F8F5\bin\external\aspect_rules_js\npm\private\lifecycle\lifecycle-hooks.bat source-map ../../../external/npm_icon_converter__source-map__0.6.1/package ... (remaining 1 argument skipped)
'""' is not recognized as an internal or external command,
operable program or batch file.
```
This is due to this snippet from `lifecycle-hooks.bat`, where the last line should probably contain the infered `bash.exe`:
```
call :rlocation "aspect_rules_js/npm/private/lifecycle/lifecycle-hooks.sh" run_script
for %%a in ("") do set "bash_bin_dir=%%~dpa"
set PATH=%bash_bin_dir%;%PATH%
set args=%*
rem Escape \ and * in args before passsing it with double quote
if defined args (
set args=!args:\=\\\\!
set args=!args:"=\"!
)
"" -c "!run_script! !args!"
```
I can' find documentation that this rule-set requires `bash` on Windows. All I could find is this comment https://github.com/aspect-build/rules_js/pull/352/files#r937023982.
Contributor guide
Research direction
Start with the lifecycle-hooks.bat snippet in the report and compare it with lifecycle-hooks.sh, tracing how bash_bin_dir and the final command are generated on Windows. Reproduce the v1.0.0 build without bash.exe or msys, then verify that the failure is no longer cryptic and that the documented Windows requirement matches the actual behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100