Skip to content

Commit 316de96

Browse files
Fix initializeCommand: use bash with wslpath/cygpath/tmp fallback chain
Reverts the PowerShell approach (Windows-only) in favour of a portable bash command that works across all environments: - WSL2 bash: wslpath converts Windows TEMP to /mnt/c/... - Git Bash (Windows): cygpath converts Windows TEMP to /c/... - macOS/Linux: both unavailable, falls back to /tmp Also stages ~/.npmrc alongside the CA cert so the Repox token is available inside the container without manual setup. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent f69a04c commit 316de96

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
"remoteUser": "node",
1818
// initializeCommand runs on the host before container creation (before the repo is cloned).
1919
// It stages the corporate CA cert and ~/.npmrc into a temp directory that Docker can bind-mount.
20-
// ${localEnv:TEMP:/tmp}: Windows TEMP on WSL2 (Docker Desktop-accessible) or /tmp on Linux/macOS.
21-
// wslpath converts the Windows path to a WSL2 Unix path; the || echo fallback is used elsewhere.
20+
// Path conversion: wslpath (WSL2 bash), cygpath (Git Bash on Windows), or /tmp (macOS/Linux).
2221
"initializeCommand": [
2322
"bash", "-c",
24-
"STAGING=$(wslpath -u '${localEnv:TEMP:/tmp}' 2>/dev/null || echo '${localEnv:TEMP:/tmp}') && (cp \"${NODE_EXTRA_CA_CERTS:-}\" \"$STAGING/dc-cert.crt\" 2>/dev/null || touch \"$STAGING/dc-cert.crt\") && (cp ~/.npmrc \"$STAGING/dc-npmrc\" 2>/dev/null || touch \"$STAGING/dc-npmrc\")"
23+
"STAGING=$(wslpath -u '${localEnv:TEMP:/tmp}' 2>/dev/null || cygpath -u '${localEnv:TEMP:/tmp}' 2>/dev/null || echo /tmp) && (cp \"${NODE_EXTRA_CA_CERTS:-}\" \"$STAGING/dc-cert.crt\" 2>/dev/null || touch \"$STAGING/dc-cert.crt\") && (cp ~/.npmrc \"$STAGING/dc-npmrc\" 2>/dev/null || touch \"$STAGING/dc-npmrc\")"
2524
],
2625
"mounts": [
2726
"source=${localEnv:TEMP:/tmp}/dc-cert.crt,target=/tmp/corporate-ca.crt,type=bind,consistency=cached,readonly",

0 commit comments

Comments
 (0)