fix: ensure npm cache directory has correct permissions

Fix EACCES permission error when running npx commands (e.g., MCP servers)
inside the Docker container.

Error that was occurring:
  npm error code EACCES
  npm error syscall mkdir
  npm error path /home/automaker/.npm/_cacache/index-v5/1f/fc
  npm error errno EACCES
  npm error Your cache folder contains root-owned files, due to a bug in
  npm error previous versions of npm which has since been addressed.

The fix ensures the /home/automaker/.npm directory exists and has correct
ownership before switching to the automaker user in the entrypoint script.
This commit is contained in:
Soham Dasgupta
2026-01-14 00:49:28 +05:30
parent 6f55da46ac
commit 1a1517dffb

View File

@@ -47,6 +47,13 @@ fi
chown -R automaker:automaker /home/automaker/.cache/opencode chown -R automaker:automaker /home/automaker/.cache/opencode
chmod -R 700 /home/automaker/.cache/opencode chmod -R 700 /home/automaker/.cache/opencode
# Ensure npm cache directory exists with correct permissions
# This is needed for using npx to run MCP servers
if [ ! -d "/home/automaker/.npm" ]; then
mkdir -p /home/automaker/.npm
fi
chown -R automaker:automaker /home/automaker/.npm
# If CURSOR_AUTH_TOKEN is set, write it to the cursor auth file # If CURSOR_AUTH_TOKEN is set, write it to the cursor auth file
# On Linux, cursor-agent uses ~/.config/cursor/auth.json for file-based credential storage # On Linux, cursor-agent uses ~/.config/cursor/auth.json for file-based credential storage
# The env var CURSOR_AUTH_TOKEN is also checked directly by cursor-agent # The env var CURSOR_AUTH_TOKEN is also checked directly by cursor-agent