Skip to content

Commit 5bb5fd9

Browse files
Mossakaclaude
andauthored
feat: support npm install -g in agent container (#1712)
* feat: support npm install -g in agent container (#1295) Configure NPM_CONFIG_PREFIX to $HOME/.npm-global so that `npm install -g` works inside the AWF agent container where /usr is mounted read-only. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: guard NPM_CONFIG_PREFIX to preserve user-provided values Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2c81abd commit 5bb5fd9

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

containers/agent/entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,13 @@ AWFEOF
681681
echo "export GOROOT=\"${AWF_GOROOT}\"" >> "/host${SCRIPT_FILE}"
682682
fi
683683
fi
684+
# Configure npm global prefix to a writable directory (since /usr is read-only)
685+
# Preserve user-provided NPM_CONFIG_PREFIX if already set
686+
echo 'if [ -z "${NPM_CONFIG_PREFIX:-}" ]; then' >> "/host${SCRIPT_FILE}"
687+
echo ' export NPM_CONFIG_PREFIX="$HOME/.npm-global"' >> "/host${SCRIPT_FILE}"
688+
echo 'fi' >> "/host${SCRIPT_FILE}"
689+
echo 'mkdir -p "$NPM_CONFIG_PREFIX/bin" 2>/dev/null' >> "/host${SCRIPT_FILE}"
690+
echo 'export PATH="$NPM_CONFIG_PREFIX/bin:$PATH"' >> "/host${SCRIPT_FILE}"
684691
# Append the actual command arguments
685692
# Docker CMD passes commands as ['/bin/bash', '-c', 'command_string'].
686693
# Instead of writing the full [bash, -c, cmd] via printf '%q' (which creates

0 commit comments

Comments
 (0)