Hmm, this is weird, why would this not work? ```13...
# general
f
Hmm, this is weird, why would this not work?
Copy code
13:58:46.73 [ERROR] 1 Exception encountered:

Engine traceback:
  in `run` goal

ValueError: Could not find a binary with name `npm`. The following paths were searched: /usr/bin, /bin, /usr/local/bin, /opt/homebrew/bin.

peder(feature/widgets)$ which npm
/opt/homebrew/bin/npm
But when i do
pants run 3rdparty/sys:node -- --version
it works. Hm!
Copy code
# Frontend folder BUILD
files(
   name = "package",
   sources = [
      "package.json",
      "package-lock.json",
   ]
)

files(
   name = "src",
   sources = [
      "./src/*.js",
      "./src/*.html",
      "./src/*.css",
   ]
)

adhoc_tool(
   name = "dependencies",
   runnable="//3rdparty/sys:npm",
   runnable_dependencies=[
      "//3rdparty/sys:npm",
   ],
   args=["i"],
   execution_dependencies = [
      ":package",
   ],
   output_directories = ["node_modules"],
)

adhoc_tool(
   name = "build",
   runnable = "//3rdparty/sys:npm",
   runnable_dependencies=[
      "//3rdparty/sys:npm",
   ],
   args = ["run","package"],
   execution_dependencies = [
      ":dependencies",
      ":src",
   ],
   output_directories = ["dist"],
)

run_shell_command(
   name = "mock",
   command = "ls",
   runnable_dependencies=["//3rdparty/sys:npm"],
   execution_dependencies = [":build"],)
---
#3rdparty/sys/BUILD

system_binary(
   name = "node",
   description = "The Javascript Runtime.",
   binary_name = "node",
   #fingerprint = r"v20.8.[0-9]+",
   #fingerprint_args = ["--version"],
)

system_binary(
   name = "npm",
   description = "The Node Package Manager.",
   binary_name = "npm",
   #fingerprint = r"v10.1.[0-9]+",
   #fingerprint_args = ["--version"],
   #fingerprint_dependencies = [":node"],
)
I commented out the fingerprinting part since I thought it was causing the issue/.
b
I went through a similar issue, apparently just doing
npm
returns a non-zero exit code I ended up working around it by using
shell_command
instead https://github.com/pantsbuild/pants/issues/19013