cool-easter-32542
11/13/2024, 2:35 PMcp, c++, make, etc, especially when using node-gyp. So when npm install / yarn install runs, these additional tools would need to be included in the sandbox's binary shims.
Currently we have a hardcoded set of tools that are included in the sandbox:
pants/src/python/pants/backend/javascript/subsystems/nodejs.py
Lines 351 to 367 in</pantsbuild/pants/commit/0d139ea19a0e9b2c7408e0103e62eeeed8e16d87|0d139ea>
| @rule(level=LogLevel.DEBUG) |
| --------------------------------------------------------------- |
| async def node_process_environment( |
| binaries: NodeJSBinaries, nodejs: NodeJS.EnvironmentAware |
| ) -> NodeJSProcessEnvironment: |
| default_required_tools = ["sh", "bash"] |
| tools_used_by_setup_scripts = ["mkdir", "rm", "touch", "which"] |
| pnpm_shim_tools = ["sed", "dirname"] |
| binary_shims = await Get( |
| BinaryShims, |
| BinaryShimsRequest.for_binaries( |
| *default_required_tools, |
| *tools_used_by_setup_scripts, |
| *pnpm_shim_tools, |
| rationale="execute a nodejs process", |
| search_path=nodejs.executable_search_path, |
| ), |
| ) |
, but iiuc there is no way to specify such additional tools.
Describe the solution you'd like
Maybe we could have an option tools on the nodejs subsystem where we could specify which additional tools to include during nodejs processes invocation, similar to the tools option we have on the docker subsystem: https://www.pantsbuild.org/2.22/reference/subsystems/docker#tools.
Describe alternatives you've considered
None.
Additional context
When such additional tools are not included in the sandbox, e.g. cp, the package manager installation, in this case yarn install, fails with:
/bin/sh: cp: command not found
make: *** [../build/bindings/iltorb.node] Error 127
gyp ERR! build error
pantsbuild/pants