Open lummax opened 2 years ago
Thanks for the report and the diagnoses. I'll put this on list for the 1.2 release but I don't have a timeline on when it will be fixed. We're always looking for OSS sponsorship to help prioritize issues like this. https://opencollective.com/aspect-build
@lummax There have been quite a few changes to the lifecycle hooks code since this was reported. Is this still an issue for you?
Windows support is low priority for rules_js at this point since the number of users using Windows with rules_js that we know of is quite low and the time that we have to spend on unfunded OSS is limited.
Yes, unfortunately our code still does not work on Windows even with the 1.17.1
of rules_js
. The current error:
ERROR: C:/users/XXX/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\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.
Target //:install failed to build
So the error changed a little, but I think I remember a similar error while tinkering with the rules_js
when I initially opened this ticket.
The sad news: I was unfortunately unable to get buy-in for contributing funding to rules_js
. bazel
migration of our JS/TS was pushed down on the roadmap. And I am leaving this job soon, so I will be unable to access the problematic code and answer questions here. So feel free to close/de prioritize this ticket :/
I'll leave it open for visibility although we have no plans to address complex and expensive rules_js Windows issues at the moment since we don't use Windows ourselves for development and we have no active clients that require it. There is a chance of a client that is using Windows wanting help with rules_js in Q2 or Q3 so we may pick some of the issues up at that point if it materializes.
ERROR: C:/users/XXX/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\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. Target //:install failed to build
We ran into the same issue. Ultimately, I found that the issue is caused when bash.exe
is not in $PATH
, because of this code.
Adding the correct MSYS2 path (in our case c:\tools\msys64\usr\bin
) to the Windows PATH
variable fixed this error.
I get the following build error on Windows with
rules_js
from the currentmain
branch while trying to run the lifecycle hooks during the install of an npm package:This is due to the executable check in https://github.com/aspect-build/rules_js/blob/95f3b545b1f5c017b19d4cfe50cecd3f31a60761/js/private/js_binary.sh.tpl#L304-L307 not working correctly on Windows with a symlink to a bat file.
If this check is removed, the following build error while running the lifecycle hooks during the install of https://www.npmjs.com/package/sharp appears:
Full error:
This is due to the code in https://github.com/aspect-build/rules_js/blob/95f3b545b1f5c017b19d4cfe50cecd3f31a60761/npm/private/lifecycle/lifecycle-hooks.js#L49-L56 not producing a
*.bat
file. Ayarn install
on Windows creates the following*.bat
file in the.bin
directory: