rules_js
rules_js copied to clipboard
`npm_import()` fails on Windows if `tar` is not globally installed
On a Windows system without a globally available tar
executable, a npm_translate_lock()
leads to the following error:
C:/users/XXX/XXX/hlezeung/external/aspect_rules_js/npm/npm_import.bzl:67:30: in <toplevel>
ERROR: An error occurred during the fetch of repository 'npm_icon_converter__simple-swizzle__0.2.2':
Traceback (most recent call last):
File "C:/users/XXX/XXX/hlezeung/external/aspect_rules_js/npm/private/npm_import.bzl", line 375, column 13, in _impl
fail(msg)
Error in fail: tar package failed:
STDOUT:
STDERR:
java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("tar" -xf package.tgz --strip-components 1 -C package --no-same-owner --no-same-permissions): The system cannot find the file specified.
(error: 2)
ERROR: C:/users/XXX/desktop/XXX/WORKSPACE.bazel:392:32: fetching _npm_import rule //external:npm_icon_converter__simple-swizzle__0.2.2: Traceback (most recent call last):
File "C:/users/XXX/XXX/hlezeung/external/aspect_rules_js/npm/private/npm_import.bzl", line 375, column 13, in _impl
fail(msg)
Error in fail: tar package failed:
STDOUT:
STDERR:
java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("tar" -xf package.tgz --strip-components 1 -C package --no-same-owner --no-same-permissions): The system cannot find the file specified.
(error: 2)
Corresponding source:
https://github.com/aspect-build/rules_js/blob/1117ff954fe80876fda9f0581eb1f9107aa0ec2f/npm/private/npm_import.bzl#L364
Not sure what the best fix would be:
- add a
tar
binary as withyq
/jq
- use an already available
tar
from another rule set (if that exists, I was unable to find one) - add a python wrapper script that acts as
tar
- use
download_and_extract()
and introduce magic to strip the first component
My colleagues just informed me that one can expect a globally available tar
executable on any reasonable recent Windows machine. So feel free to close.
I guess we could print a warning at least, before closing this.