{"record":{"id":"adcaf56bee5dd7e0","repo":"docmirror/dev-sidecar","slug":"error-adcaf5","errorCode":null,"errorMessage":"暂未实现此功能","messagePattern":"暂未实现此功能","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/core/src/shell/scripts/set-npm-env.js","lineNumber":17,"sourceCode":"/**\n * 设置环境变量\n */\nconst Shell = require('../shell')\n\nconst execute = Shell.execute\n\nconst executor = {\n  async windows (exec, { list }) {\n    const cmds = []\n    for (const item of list) {\n      cmds.push(`npm config set ${item.key}  ${item.value}`)\n    }\n    return await exec(cmds, { type: 'cmd' })\n  },\n  async linux (exec, { port }) {\n    throw new Error('暂未实现此功能')\n  },\n  async mac (exec, { port }) {\n    throw new Error('暂未实现此功能')\n  },\n}\n\nmodule.exports = async function (args) {\n  return execute(executor, args)\n}\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/docmirror/dev-sidecar/blob/7710cd56cce760c708f30b01d2d4056eb8c402d5/packages/core/src/shell/scripts/set-npm-env.js#L1-L27","documentation":"set-npm-env configures npm proxy-related settings by shelling out to `npm config set`. Only the Windows executor is implemented; the linux executor is a stub that unconditionally throws this 'not yet implemented' placeholder. It is a deliberate feature gap, not a runtime failure of your input.","triggerScenarios":"Calling the set-npm-env shell script (executor dispatch) with platform=linux — i.e. invoking DevSidecar's npm environment setup API on any Linux system.","commonSituations":"Running dev-sidecar or the CLI on a Linux server/desktop where the app tries to point npm at the local proxy; CI pipelines on Linux runners; WSL sessions detected as Linux.","solutions":["Set the npm config manually: `npm config set proxy http://127.0.0.1:<port>` and `npm config set https-proxy http://127.0.0.1:<port>`.","Or use environment variables instead: export HTTP_PROXY/HTTPS_PROXY pointing at the local dev-sidecar port.","Contribute/patch the linux executor in packages/core/src/shell/scripts/set-npm-env.js to run the same `npm config set` commands via exec.","Run the affected tooling under a platform where the feature exists (Windows) if practical."],"exampleFix":"// before (stub in set-npm-env.js)\nasync linux (exec, { port }) {\n  throw new Error('暂未实现此功能')\n}\n// after (naive implementation mirroring the windows branch)\nasync linux (exec, { list }) {\n  const cmds = list.map(item => `npm config set ${item.key} ${item.value}`)\n  return exec(cmds, { type: 'cmd' })\n}","handlingStrategy":"fallback","validationCode":"const os = require('os')\nif (os.platform() !== 'win32') {\n  // set npm proxy manually instead of calling set-npm-env\n  const { execSync } = require('child_process')\n  execSync(`npm config set proxy http://127.0.0.1:${port}`)\n  execSync(`npm config set https-proxy http://127.0.0.1:${port}`)\n}","typeGuard":"null","tryCatchPattern":"try {\n  await setNpmEnv({ list })\n} catch (e) {\n  if (e.message === '暂未实现此功能' && process.platform === 'linux') {\n    // fall back to env vars or direct npm config\n    process.env.HTTP_PROXY = `http://127.0.0.1:${port}`\n    process.env.HTTPS_PROXY = `http://127.0.0.1:${port}`\n  } else throw e\n}","preventionTips":["Gate npm-env features on platform === 'win32' in your own code.","Prefer HTTP(S)_PROXY environment variables on Linux — npm honors them without npm config changes.","Check the package docs/issues for Linux support status before enabling the feature.","Contribute the linux executor upstream rather than relying on the stub."],"tags":["linux","npm","not-implemented","proxy-config"],"backgroundTag":"feature-not-implemented-on-platform","analyzedSha":"7710cd56cce760c708f30b01d2d4056eb8c402d5","analyzedAt":"2026-08-31T22:07:07.234Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}