gentle-flower-25372
04/12/2024, 5:44 PMValueError: Could not find a binary with name `node`. The following paths were searched: /usr/bin, /bin, /usr/local/bin, /opt/homebrew/bin.
$ PATH=/usr/bin:/bin:/usr/local/bin:/opt/homebrew/bin which node
/opt/homebrew/bin/node
$ PATH=/usr/bin:/bin:/usr/local/bin:/opt/homebrew/bin node --version
v18.19.1
$ echo $?
0
system_binary(
name="node",
binary_name="node",
fingerprint_args=["--version"],
)wide-midnight-78598
04/12/2024, 5:50 PM# Vite needs `dirname` to be in the environment
system_binary(
name="dirname",
binary_name="dirname",
# MacOS doesn't have a `--version` flag, so we need to pass something otherwise dirname errors
fingerprint_args=["some-random-string-so-dirname-doesnt-fail"],
)
This is how I currently grab node
# Pull the host's `node` into the environment
system_binary(
name="node",
binary_name="node",
fingerprint=r"v(20|[1-9][0-9])\..*\..*",
fingerprint_args=["--version"],
)
If you keep sandboxes, can you check the path that the sandbox uses?gentle-flower-25372
04/12/2024, 6:03 PMgentle-flower-25372
04/12/2024, 6:04 PMgentle-flower-25372
04/12/2024, 6:06 PMdiff --git i/src/python/pants/backend/adhoc/run_system_binary.py w/src/python/pants/backend/adhoc/run_system_binary.py
index 4b6e8272fc..6b5ca74a52 100644
--- i/src/python/pants/backend/adhoc/run_system_binary.py
+++ w/src/python/pants/backend/adhoc/run_system_binary.py
@@ -103,18 +103,29 @@ async def _find_binary(
for path in binaries.paths
)
+ logger.debug(f"[{binary_name}] tests: {tests}")
+ logger.debug(f"[{binary_name}] binaries.paths: {binaries.paths}")
+
for test, binary in zip(tests, binaries.paths):
+ <http://logger.info|logger.info>(f"{binary} for loop entrance")
if test.exit_code != 0:
+ logger.warn(f"[{binary_name}] {binary} did not exit 0")
continue
if fingerprint_pattern:
fingerprint = test.stdout.decode().strip()
match = re.match(fingerprint_pattern, fingerprint)
if not match:
+ logger.warn(
+ f"[{binary_name}] {binary} did not match fingerprint pattern"
+ )
continue
+ <http://logger.info|logger.info>(f"returning binary: {binary}")
return binary
+ logger.error(f"Couldn't find any binary for {binary_name}")
+
raise ValueError(
f"Could not find a binary with name `{binary_name}`"
+ (
@@ -134,7 +145,9 @@ async def create_system_binary_run_request(
assert field_set.name.value is not None
extra_search_paths = field_set.extra_search_paths.value or ()
- search_path = SearchPath((*extra_search_paths, *system_binaries.system_binary_paths))
+ search_path = SearchPath(
+ (*extra_search_paths, *system_binaries.system_binary_paths)
+ )
path = await _find_binary(
field_set.address,
This shows pants looking up node twice, one time it finds it, another time it doesn't.wide-midnight-78598
04/12/2024, 6:10 PMsystem_binarywide-midnight-78598
04/12/2024, 6:12 PMextra_search_paths=["/opt/homebrew/bin"] type of thing you can try?wide-midnight-78598
04/12/2024, 6:13 PMfingerprint and seeing if that helps? Or alternatively, what about ditching fingerprint_args in case that helps?
I think these are often used if you have multiple binaries, but 🤷wide-midnight-78598
04/12/2024, 6:19 PMgentle-flower-25372
04/12/2024, 6:20 PM--no-pantsd --no-local-cachewide-midnight-78598
04/12/2024, 6:27 PMgentle-flower-25372
04/12/2024, 6:27 PMgentle-flower-25372
04/12/2024, 6:27 PMwide-midnight-78598
04/12/2024, 6:31 PMpants --no-pantsd --keep-sandboxes=always run blahblah/web:node
Preserving local process execution dir /private/var/folders/dy/q08y_dts5vd71rm99t4gc9lr0000gp/T/pants-sandbox-Z7g6oc for Searching for `node` on PATH=/usr/bin:/bin:/usr/local/bin:/opt/homebrew/bin
Then you can open that, and run sh __run.sh
Maybe there is a hint in there?gentle-flower-25372
04/12/2024, 6:32 PMgentle-flower-25372
04/12/2024, 6:33 PM$ pants --keep-sandboxes=always --no-pantsd --no-local-cache -ldebug run apps/atlas-interactive:node -- --version
12:33:11.43 [DEBUG] Completed: setup_sandbox
v18.19.1gentle-flower-25372
04/12/2024, 6:34 PMsrc/python/pants/backend/adhoc/run_system_binary.py I know for a fact it finds it, but for some reason it's looking twice and the second one fails.wide-midnight-78598
04/12/2024, 6:34 PMgentle-flower-25372
04/12/2024, 6:34 PMgentle-flower-25372
04/12/2024, 6:35 PMwide-midnight-78598
04/12/2024, 6:35 PMrunnable_dependencies=[":node", ":sh"],?gentle-flower-25372
04/12/2024, 6:35 PMrunnable_dependencies=[":node", ":sed", ":readlink", ":dirname", ":uname"],gentle-flower-25372
04/12/2024, 6:35 PMgentle-flower-25372
04/12/2024, 6:35 PMgentle-flower-25372
04/12/2024, 6:35 PMgentle-flower-25372
04/12/2024, 6:36 PMsystem_binary(
name="sed",
binary_name="sed",
fingerprint_args=["--help"],
extra_search_paths=["/opt/homebrew/opt/gnu-sed/libexec/gnubin"],
)
system_binary(
name="readlink",
binary_name="readlink",
fingerprint_args=["--help"],
extra_search_paths=["/opt/homebrew/opt/coreutils/libexec/gnubin"],
)
system_binary(
name="dirname",
binary_name="dirname",
fingerprint_args=["--help"],
extra_search_paths=["/opt/homebrew/opt/coreutils/libexec/gnubin"],
)
system_binary(
name="uname",
binary_name="uname",
fingerprint_args=["--help"],
extra_search_paths=["/opt/homebrew/opt/coreutils/libexec/gnubin"],
)
system_binary(
name="node",
binary_name="node",
)
system_binary(
name="yarn",
binary_name="yarn",
fingerprint_dependencies=[":node"],
)
adhoc_tool(
name="yarn_install",
runnable=":yarn",
runnable_dependencies=[":node", ":sed", ":readlink", ":dirname", ":uname"],
args=[
"install",
"--non-interactive",
"--frozen-lockfile",
"--prefer-offline",
"--cache-folder",
"./yarn-cache",
],
extra_env_vars=["NODE_ENV=production", "NEXT_TELEMETRY_DISABLED=1"],
output_directories=["node_modules/"],
output_dependencies=[":package_config"],
execution_dependencies=[":package_config"],
)wide-midnight-78598
04/12/2024, 6:37 PMgentle-flower-25372
04/12/2024, 6:38 PM$ ./__run.sh
+ CHECK_FILE_ENTRIES=
+ for path in '${PATH//:/ }'
+ [[ -d /usr/bin ]]
+ maybe_exe=/usr/bin/node
+ [[ node == \n\o\d\e ]]
+ [[ -f /usr/bin/node ]]
+ for path in '${PATH//:/ }'
+ [[ -d /bin ]]
+ maybe_exe=/bin/node
+ [[ node == \n\o\d\e ]]
+ [[ -f /bin/node ]]
+ for path in '${PATH//:/ }'
+ [[ -d /usr/local/bin ]]
+ maybe_exe=/usr/local/bin/node
+ [[ node == \n\o\d\e ]]
+ [[ -f /usr/local/bin/node ]]
+ for path in '${PATH//:/ }'
+ [[ -d /opt/homebrew/bin ]]
+ maybe_exe=/opt/homebrew/bin/node
+ [[ node == \n\o\d\e ]]
+ [[ -f /opt/homebrew/bin/node ]]
+ [[ -x /opt/homebrew/bin/node ]]
+ echo /opt/homebrew/bin/node
/opt/homebrew/bin/nodegentle-flower-25372
04/12/2024, 6:39 PMwide-midnight-78598
04/12/2024, 6:39 PMnode so, is the problem being called because of something else, and node is the error returned (e.g. like, yarn's dependency, or something)wide-midnight-78598
04/12/2024, 6:39 PMyarn globally available too?gentle-flower-25372
04/12/2024, 6:39 PMgentle-flower-25372
04/12/2024, 6:39 PM12:34:55.34 [DEBUG] [node] tests: ()
12:34:55.34 [DEBUG] [node] binaries.paths: ()gentle-flower-25372
04/12/2024, 6:39 PM12:34:54.90 [DEBUG] [node] tests: (FallibleProcessResult(stdout=b'', stdout_digest=FileDigest('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 0), stderr=b'', stderr_digest=FileDigest('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 0), exit_code=0, output_digest=Digest('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 0), metadata=ProcessResultMetadata(total_elapsed_ms=301, execution_environment=ProcessExecutionEnvironment(environment=ProcessExecutionEnvironment { name: None, platform: Macos_arm64, strategy: Local }), _source='ran', source_run_id=0)),)
12:34:54.90 [DEBUG] [node] binaries.paths: (BinaryPath(path='/opt/homebrew/bin/node', fingerprint='e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'),)gentle-flower-25372
04/12/2024, 6:40 PMgentle-flower-25372
04/12/2024, 6:41 PMwide-midnight-78598
04/12/2024, 6:41 PMpants --keep-sandboxes=always --no-pantsd --no-local-cache -ldebug run apps/atlas-interactive:node -- --version
So that works, what about:
pants --keep-sandboxes=always --no-pantsd --no-local-cache -ldebug run apps/atlas-interactive:yarn -- --versiongentle-flower-25372
04/12/2024, 6:42 PMgentle-flower-25372
04/12/2024, 6:42 PMwide-midnight-78598
04/12/2024, 6:43 PMwide-midnight-78598
04/12/2024, 6:44 PMgentle-flower-25372
04/12/2024, 6:44 PMwide-midnight-78598
04/12/2024, 6:52 PM