silly-queen-7197
09/30/2025, 1:22 AMpnpm i first to get pants run commands working? I can get pants package to work against node_build_script. But with node_run_script I always seem to get
` WARN Local package.json exists, but node_modules missing, did you mean to install?`
When I* inspect sandboxes I see
$ cat __run.sh
#!/usr/bin/env bash
# This command line should execute the same process as pants did internally.
cd /home/yjabri/...
env -i ...
If I copy the env -i and run it in the sandbox, the command works. Is this a known issue? Should I create an issue*?silly-queen-7197
09/30/2025, 1:26 AM$ pants --no-pantsd --keep-sandboxes=always package expo2/typescript/:pkg#build
01:24:44.32 [INFO] Preserving local process execution dir /tmp/pants-sandbox-qMXh02 for Test binary /bin/node.
01:24:44.32 [INFO] Preserving local process execution dir /tmp/pants-sandbox-MMlUQ1 for Test binary /usr/bin/node.
01:24:44.35 [INFO] Completed: Scheduling: Test binary /bin/node.
01:24:44.36 [INFO] Completed: Scheduling: Test binary /usr/bin/node.
01:24:44.39 [INFO] Preserving local process execution dir /tmp/pants-sandbox-tZkERa for Test binary /bin/bash.
01:24:44.39 [INFO] Preserving local process execution dir /tmp/pants-sandbox-dbkOye for Test binary /usr/bin/bash.
01:24:44.41 [INFO] Completed: Scheduling: Test binary /bin/bash.
01:24:44.42 [INFO] Completed: Scheduling: Test binary /usr/bin/bash.
01:24:44.42 [INFO] Completed: Scheduling: Enabling corepack shims
01:24:44.46 [INFO] Completed: Scheduling: Preparing configured pnpm@9.15.6.
01:24:44.65 [INFO] Completed: Scheduling: Installing @archipelago/expo2@1.0.0.
01:24:44.83 [INFO] Completed: Scheduling: Running node build script 'build'.
01:24:44.84 [INFO] Wrote dist/dist
I thought I was able to get a sandbox once for package* but maybe I’m mistaken? This is something I still don’t really understand about pants. Sometimes there are sandboxes, sometimes --keep-sandboxes does nothing or just produces them for steps like Test binary /usr/bin/nodesilly-queen-7197
09/30/2025, 1:33 AM$ pants --no-pantsd --keep-sandboxes=always package expo2/typescript/:pkg#build
01:32:06.21 [INFO] Preserving local process execution dir /tmp/pants-sandbox-0QeDqH for Test binary /bin/node.
01:32:06.21 [INFO] Preserving local process execution dir /tmp/pants-sandbox-qIfWzO for Test binary /usr/bin/node.
01:32:06.23 [INFO] Completed: Scheduling: Test binary /bin/node.
01:32:06.24 [INFO] Completed: Scheduling: Test binary /usr/bin/node.
01:32:06.29 [INFO] Preserving local process execution dir /tmp/pants-sandbox-RICPxI for Test binary /bin/bash.
01:32:06.29 [INFO] Preserving local process execution dir /tmp/pants-sandbox-BSyRAq for Test binary /usr/bin/bash.
01:32:06.31 [INFO] Completed: Scheduling: Test binary /bin/bash.
01:32:06.31 [INFO] Completed: Scheduling: Test binary /usr/bin/bash.
01:32:06.31 [INFO] Preserving local process execution dir /tmp/pants-sandbox-cgLRjc for Enabling corepack shims
01:32:06.42 [INFO] Completed: Scheduling: Enabling corepack shims
01:32:06.42 [INFO] Preserving local process execution dir /tmp/pants-sandbox-W399Px for Preparing configured pnpm@9.15.6.
01:32:08.16 [INFO] Completed: Scheduling: Preparing configured pnpm@9.15.6.
01:32:08.16 [INFO] Preserving local process execution dir /tmp/pants-sandbox-04AjlA for Installing @archipelago/expo2@1.0.0.
01:32:14.17 [INFO] Completed: Installing @archipelago/expo2@1.0.0.
01:32:14.19 [INFO] Completed: Scheduling: Installing @archipelago/expo2@1.0.0.
01:32:14.20 [INFO] Preserving local process execution dir /tmp/pants-sandbox-sW8LiG for Running node build script 'build'.
01:32:19.80 [INFO] Completed: Running node build script 'build'.
01:32:19.80 [INFO] Completed: Scheduling: Running node build script 'build'.
01:32:19.81 [INFO] Wrote dist/dist
it has
# This command line should execute the same process as pants did internally.
cd /tmp/pants-sandbox-sW8LiG/
Which looks right!silly-queen-7197
09/30/2025, 1:34 AMpnpm i but it feels like a pants smell (I regret typing that) to need to do that to get run to work.wide-midnight-78598
09/30/2025, 1:35 AMwide-midnight-78598
09/30/2025, 1:37 AMAdded new build file alias `node_run_script` to allow generating node script targets that are not tied to packaging and can be executed via the `run` goal.wide-midnight-78598
09/30/2025, 1:43 AM@dataclass(frozen=True)
class RunNodeScriptFieldSet(RunFieldSet):
required_fields = (NodeRunScriptEntryPointField, NodePackageDependenciesField)
run_in_sandbox_behavior = RunInSandboxBehavior.RUN_REQUEST_HERMETIC
entry_point: NodeRunScriptEntryPointField
extra_env_vars: NodeRunScriptExtraEnvVarsField
environment: EnvironmentField
though.
Are you able to add a package dependency, and does that work?silly-queen-7197
09/30/2025, 3:51 PMpackage_json(
scripts=[
node_run_script(entry_point="dev"),
node_build_script(
entry_point="build",
output_directories=["dist"],
)
],
dependencies=[":tsconfig", "//:tsconfig", "./src"],
)
file(
name="tsconfig",
source="tsconfig.json"
)
What I don’t understand is the sandbox is built when I do a pants run
╰❱ ls
__node package.json
__run.sh packages
_binary_shims_cdd60ac6ea9db484515d1bc36e0a9b992c89650ef4e5b32a200da6e9ae172946 pnpm-lock.yaml
apps pnpm-workspace.yaml
node_modules tsconfig.json
Its just not used because of the cd
╰❱ cat __run.sh
#!/usr/bin/env bash
# This command line should execute the same process as pants did internally.
cd /Users/yjabri/Misc/try-pnpmsilly-queen-7197
09/30/2025, 3:52 PMsilly-queen-7197
09/30/2025, 3:56 PMpants --keep-sandboxes=always run path/to/some/python/file.py and it also has a cd /home/yjabri . So I think Im getting hung up on the wrong thing.silly-queen-7197
09/30/2025, 4:01 PM…pants /tmp/pants-sandbox-9yvdaa/./archipelago.pex_pex_shim.sh --help
And it does the same in node!
pnpm --filter $'@workspace/ui-library' --prefix /private/var/folders/m8/cmsvrd417n39w5xjzjhmnznm0000gq/T/pants-sandbox-8EIMGa/packages/ui-library run dev
Ok so why does it complain about node_modules…