proto: proto run npm/pnpm/yarn fails with `program not found` if bin not in path

What version?

0.23.5

Which command?

No response

What happened?

> proto run pnpm
Error:   × program not found

My path includes ~/.proto/shims but NOT ~/.proto/bin per here.

node_depman_plugin version 0.5.3 node_plugin version 0.5.3

Trace logs?

$ proto run pnpm
[DEBUG 2023-11-30 11:23:44] proto  Running proto v0.23.5  args=["C:\\Users\\dan\\.proto\\shims\\proto.exe", "run", "pnpm", "--log", "trace"]
[TRACE 23:44.785] starbase::app  Running startup phase with 1 systems
[TRACE 23:44.785] starbase::app  Running analyze phase with 1 systems
[TRACE 23:44.786] starbase::app  Running execute phase with 2 systems
[DEBUG 23:44.790] proto_core::user_config:run  Loading config.toml  file="C:\\Users\\dan\\.proto\\config.toml"
[TRACE 23:44.791] starbase_utils::fs:run  Reading file  file="C:\\Users\\dan\\.proto\\config.toml"
[DEBUG 23:44.791] proto_core::tool_loader:run  Traversing upwards to find a configured plugin  tool="pnpm"
[DEBUG 23:44.792] proto_core::tools_config:run  Loading .prototools  file="C:\\Users\\dan\\.prototools"
[TRACE 23:44.792] starbase_utils::fs:run  Reading file  file="C:\\Users\\dan\\.prototools"
[TRACE 23:44.802] warpgate::loader:run  Creating plugin loader  cache_dir="C:\\Users\\dan\\.proto\\plugins"
[TRACE 23:44.802] warpgate::loader:run  Loading plugin pnpm  plugin="pnpm"
[TRACE 23:44.803] warpgate::loader:run  Plugin already downloaded and cached  plugin="pnpm" path="C:\\Users\\dan\\.proto\\plugins\\pnpm-50fe3b6c66bfa9dd0663411862e9dd8fb7e301f8387f8dcd03a890094c977902.wasm"
[DEBUG 23:44.803] proto_core::tool_loader:run  Loading WASM plugin  source="C:\\Users\\dan\\.proto\\plugins\\pnpm-50fe3b6c66bfa9dd0663411862e9dd8fb7e301f8387f8dcd03a890094c977902.wasm"
[TRACE 23:44.804] proto_core::tool_loader:run  Storing tool identifier  id="pnpm"
[TRACE 23:44.804] proto_core::tool_loader:run  Storing user configuration  config={"auto_clean":true,"auto_install":true,"node_intercept_globals":true}
[TRACE 23:44.805] proto_core::tool_loader:run  Storing proto environment  env={"arch":"x64","os":"windows","home_dir":{"path":"/userhome/","virtual_prefix":"/userhome","real_prefix":"C:\\Users\\dan"},"proto_dir":{"path":"/proto/","virtual_prefix":"/proto","real_prefix":"C:\\Users\\dan\\.proto"}}
[DEBUG 23:44.805] proto_core::tool:run  Creating tool pnpm and instantiating plugin
[DEBUG 23:44.806] proto_core::tool_manifest:run:load  Loading manifest.json  file="C:\\Users\\dan\\.proto\\tools\\pnpm\\manifest.json"
[TRACE 23:44.806] starbase_utils::fs:run:load  Opening file  file="C:\\Users\\dan\\.proto\\tools\\pnpm\\manifest.json"
[TRACE 23:44.807] starbase_utils::fs_lock:run:load  Locking file  file="C:\\Users\\dan\\.proto\\tools\\pnpm\\manifest.json"
[TRACE 23:44.808] starbase_utils::fs_lock:run:load  Unlocking file  file="C:\\Users\\dan\\.proto\\tools\\pnpm\\manifest.json"
[DEBUG 23:45.017] proto_core::tool:run  Created tool pnpm and its WASM runtime
[TRACE 23:45.018] warpgate::plugin:run  Calling plugin function register_tool  plugin="pnpm" input={"id":"pnpm"}
[TRACE 23:45.019] warpgate::plugin:run  Called plugin function register_tool  plugin="pnpm" output={"inventory":{},"name":"pnpm","plugin_version":"0.5.3","type":"DependencyManager"}
[TRACE 23:45.019] proto_core::version_detector:run  Attempting to find local version from config files  tool="pnpm"
[DEBUG 23:45.020] proto_core::user_config:run  Loading config.toml  file="C:\\Users\\dan\\.proto\\config.toml"
[TRACE 23:45.020] starbase_utils::fs:run  Reading file  file="C:\\Users\\dan\\.proto\\config.toml"
[TRACE 23:45.021] proto_core::version_detector:run  Checking directory  tool="pnpm" dir="C:\\Users\\dan"
[DEBUG 23:45.021] proto_core::tools_config:run  Loading .prototools  file="C:\\Users\\dan\\.prototools"
[TRACE 23:45.022] starbase_utils::fs:run  Reading file  file="C:\\Users\\dan\\.prototools"
[DEBUG 23:45.023] proto_core::version_detector:run  Detected version from .prototools file  tool="pnpm" version="latest"
 file="C:\\Users\\dan\\.prototools"
[DEBUG 23:45.024] proto_core::user_config:run  Loading config.toml  file="C:\\Users\\dan\\.proto\\config.toml"
[TRACE 23:45.025] starbase_utils::fs:run  Reading file  file="C:\\Users\\dan\\.proto\\config.toml"
[DEBUG 23:45.025] proto_core::tool:run  Resolving a semantic version or alias  tool="pnpm" initial_version="latest"
[DEBUG 23:45.026] proto_core::tool:run  Loading available versions  tool="pnpm"
[TRACE 23:45.026] starbase_utils::fs:run  Reading file metadata  file="C:\\Users\\dan\\.proto\\tools\\pnpm\\remote-versions.json"
[DEBUG 23:45.027] proto_core::tool:run  Loading from local cache  tool="pnpm" cache="C:\\Users\\dan\\.proto\\tools\\pnpm\\remote-versions.json"
[TRACE 23:45.027] starbase_utils::fs:run  Reading file  file="C:\\Users\\dan\\.proto\\tools\\pnpm\\remote-versions.json"
[TRACE 23:45.028] starbase_utils::json:run  Parsing JSON  file="C:\\Users\\dan\\.proto\\tools\\pnpm\\remote-versions.json"
[TRACE 23:45.029] warpgate::plugin:run  Calling plugin function resolve_version  plugin="pnpm" input={"initial":"latest"}
[TRACE 23:45.030] warpgate::plugin:run  Called plugin function resolve_version  plugin="pnpm" output={}
[DEBUG 23:45.030] proto_core::tool:run  Resolved to 8.11.0  tool="pnpm" version="8.11.0"
[DEBUG 23:45.031] proto_core::tool:run  Checking if tool is installed  tool="pnpm" install_dir="C:\\Users\\dan\\.proto\\tools\\pnpm\\8.11.0"
[DEBUG 23:45.032] proto_core::tool:run  Tool has already been installed, locating binaries and shims  tool="pnpm" install_dir="C:\\Users\\dan\\.proto\\tools\\pnpm\\8.11.0"
[DEBUG 23:45.032] proto_core::tool:run  Locating executable for tool  tool="pnpm"
[TRACE 23:45.033] warpgate::plugin:run  Calling plugin function locate_executables  plugin="pnpm" input={"context":{"tool_dir":{"path":"/proto/tools/pnpm/8.11.0","virtual_prefix":"/proto","real_prefix":"C:\\Users\\dan\\.proto"},"version":"8.11.0"}}
[TRACE 23:45.034] warpgate::plugin:run  Called plugin function locate_executables  plugin="pnpm" output={"globals_lookup_dirs":["$PROTO_HOME/tools/node/globals/bin"],"primary":{"exe_path":"bin/pnpm.cjs","no_bin":true,"parent_exe_name":"node"},"secondary":{"pnpx":{"no_bin":true,"shim_before_args":"dlx"}}}
[DEBUG 23:45.034] proto_core::tool:run  Found an executable  tool="pnpm" exe_path="C:\\Users\\dan\\.proto\\tools\\pnpm\\8.11.0\\bin/pnpm.cjs"
[TRACE 23:45.035] warpgate::plugin:run  Calling plugin function pre_run  plugin="pnpm" input={"context":{"tool_dir":{"path":"/proto/tools/pnpm/8.11.0","virtual_prefix":"/proto","real_prefix":"C:\\Users\\dan\\.proto"},"version":"8.11.0"},"passthrough_args":[]}
[TRACE 23:45.036] warpgate::plugin:run  Called plugin function pre_run  plugin="pnpm" output=
[DEBUG 23:45.036] proto::commands::run:run  Running pnpm  bin="node.exe" args=["C:\\Users\\dan\\.proto\\tools\\pnpm\\8.11.0\\bin/pnpm.cjs"]
[TRACE 23:45.042] starbase::app  Running shutdown phase with 1 systems
Error:   × program not found

Operating system?

Windows

Architecture?

x64

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

It was mainly about adding the PROTO_INSTALL_DIR env var. This way, you can install it to a custom location.

I’m going to close this. Let’s keep the shim convo in that new PR.

Good news, both unix/windows resolves the arg name correctly. Also got ctrl+c working super easily. https://github.com/moonrepo/proto/blob/0.24-shim/crates/cli-shim/README.md

I’ll test piping/redirects etc too, but this seems like a good win. The file size is also 400kb.

Just had a thought, thanks to this comment:

An .exe shim doesn’t necessarily need to be a new executable for each file. It could just be a symlink to proto.exe which acts based on argv[0] to delegate to the underlying tool binary.

Maybe, just maybe, we can provide 2 executables: proto(.exe) and proto-shim(.exe). This could use the argv[0] hack to “determine the correct tool” to run, and simply call proto under the hood. We could probably then eliminate bash/ps1/cmd shims entirely for both OS’s.