Skip to content

Commit a92481a

Browse files
committed
fix: resolve npm install ENOENT error in docs-site build
- Add shell access to npm environment for native module compilation - Include common shell paths (/bin, /usr/bin, /usr/local/bin) in PATH - Set SHELL environment variable explicitly for sharp package installation - Enable native Node.js modules to compile in hermetic environment
1 parent f8e7b93 commit a92481a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs-site/docs_build.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,19 @@ def main():
7575
current_path = os.environ.get("PATH", "")
7676
hermetic_path = f"{node_bin_dir}:{current_path}" if current_path else node_bin_dir
7777
78-
# Set up minimal hermetic environment for npm
78+
# Add common shell locations for native module compilation
79+
shell_paths = ["/bin", "/usr/bin", "/usr/local/bin"]
80+
for shell_path in shell_paths:
81+
if os.path.exists(shell_path) and shell_path not in hermetic_path:
82+
hermetic_path = f"{hermetic_path}:{shell_path}"
83+
84+
# Set up minimal hermetic environment for npm with shell access
7985
npm_env = {
8086
"PATH": hermetic_path,
8187
"NODE_PATH": "", # Clear any existing NODE_PATH
8288
"npm_config_cache": os.path.join(work_dir, ".npm-cache"),
8389
"npm_config_progress": "false",
90+
"SHELL": "/bin/sh", # Explicitly provide shell for native modules
8491
}
8592
8693
# Change to workspace for npm operations

0 commit comments

Comments
 (0)