docmirror/dev-sidecar · warning
暂未实现此功能
Error message
暂未实现此功能
What it means
set-system-env writes persistent environment variables (PowerShell [Environment]::SetEnvironmentVariable, with setx fallbacks) — Windows only. The linux executor is a stub that always throws this 'not yet implemented' error; your arguments are irrelevant to the outcome.
Source
Thrown at packages/core/src/shell/scripts/set-system-env.js:79
try {
for (const item of list) {
if (item.value == null) {
delete process.env[item.key]
} else {
process.env[item.key] = String(item.value)
}
}
} catch (e) {
envUpdateError = e.message || String(e)
}
return { success: true, scope: appliedScope, output: ret, envUpdateError }
} catch (finalErr) {
return { success: false, error: finalErr.message || String(finalErr), details: finalErr.stack }
}
},
async linux (exec, { port }) {
throw new Error('暂未实现此功能')
},
async mac (exec, { port }) {
throw new Error('暂未实现此功能')
},
}
module.exports = async function (args) {
return execute(executor, args)
}
View on GitHub (pinned to 7710cd56cc)
Solutions
- Persist variables yourself: add `export KEY=value` to ~/.bashrc / ~/.profile (user) or /etc/environment (system-wide).
- For systemd user services, use `systemctl --user set-environment` or drop-ins with Environment=.
- Patch the linux executor in packages/core/src/shell/scripts/set-system-env.js to append to the appropriate shell profile.
- Set the vars per-invocation instead of persisting them (prefix the command with KEY=value).
Defensive patterns
Strategy: fallback
Validate before calling
const os = require('os')
if (os.platform() !== 'win32') {
const fs = require('fs')
fs.appendFileSync(`${os.homedir()}/.bashrc`, `export HTTP_PROXY=http://127.0.0.1:${port}\nexport HTTPS_PROXY=http://127.0.0.1:${port}\n`)
} Type guard
null
Try / catch
try {
await setSystemEnv({ list })
} catch (e) {
if (e.message === '暂未实现此功能' && process.platform === 'linux') {
// write to /etc/environment or ~/.profile yourself
require('fs').appendFileSync('/etc/environment', `KEY=value\n`)
} else throw e
} Prevention
- Feature-gate persistent env-var writes on platform === 'win32'.
- On Linux prefer ~/.profile, ~/.bashrc or /etc/environment managed by your own tooling.
- For transient needs, prefix commands with the vars instead of persisting them.
- Check feature support per platform before invoking shell scripts from this library.
When it happens
Trigger: Calling the set-system-env shell script with platform=linux — attempting to persist system/user environment variables through DevSidecar on Linux.
Common situations: Trying to have dev-sidecar set HTTP_PROXY/HTTPS_PROXY or similar as persistent env vars on a Linux desktop/server; provisioning scripts reusing the Windows-oriented API.
Related errors
AI-assisted analysis of docmirror/dev-sidecar@7710cd56cc (2026-08-31).
Data as JSON: /api/errors/c396f8f9696a4dfe.
Report an issue: GitHub.