You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: add OPENCODE_DISABLE_INSTALL env var to skip npm installs at startup #37888
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
When running opencode run in Docker containers or CI/CD pipelines, opencode installs @opencode-ai/plugin and any npm plugins at startup via arborist. In environments where npm registry access is restricted (corporate networks, air-gapped systems) or undesirable (immutable production containers), this fails silently or causes unexpected network calls on every run.
Related: #37806 (the same install path failing in packaged builds), #36590 (cert errors from the same network calls).
Proposed change
Add an OPENCODE_DISABLE_INSTALL=1 environment variable. When set:
Npm.install skips arborist entirely if node_modules already exists (fast path)
Npm.install fails with a clear error if node_modules is missing (rather than silently attempting and failing)
Npm.add (on-demand plugin installs) behaves the same way
This lets you pre-warm dependencies once (e.g. opencode run "hello" during docker build) and then lock down network access for the actual container runtime with OPENCODE_DISABLE_INSTALL=1.
Implementation
Two files changed in packages/core: src/flag/flag.ts and src/npm.ts. No new dependencies, no API changes.
I have a working branch ready if the approach is acceptable.
changed the title [-]feat: add OPENCODE_DISABLE_INSTALL env var to skip npm installs at startup[/-][+][FEATURE]: add OPENCODE_DISABLE_INSTALL env var to skip npm installs at startup[/+]on Jul 20, 2026
Thanks for updating the issue! It now looks good and meets our contributing guidelines. We appreciate the detailed description of the use case and proposed implementation.
+1 - hit this exact problem running opencode run headless in a restricted-egress sandbox (FullSend/OpenShell). Adding a concrete detail on the current v1.18.23 code path in case it helps scope the fix:
In packages/core/src/npm.ts, Npm.install already fast-paths when node_modules is missing vs present, but when node_modulesis present it still runs a "dirty check" (compares package.json against package-lock.json) and calls arborist.reify() - a network install - if any declared dep isn't in the lockfile. In an air-gapped/MITM'd-registry sandbox that reify fails (ECONNRESET), even though a satisfied node_modules is already baked into the image.
OPENCODE_DISABLE_INSTALL=1 as proposed (skip arborist entirely when node_modules exists; hard-error instead of silently attempting when missing) would fully cover this. Would love to see the branch land.
Activity
github-actions commentedon Jul 20, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]: ...and include the required verification checkboxPlease edit this issue to address the above within 2 hours, or it will be automatically closed.
If you believe this was flagged incorrectly, please let a maintainer know.
[-]feat: add OPENCODE_DISABLE_INSTALL env var to skip npm installs at startup[/-][+][FEATURE]: add OPENCODE_DISABLE_INSTALL env var to skip npm installs at startup[/+]github-actions commentedon Jul 20, 2026
Thanks for updating the issue! It now looks good and meets our contributing guidelines. We appreciate the detailed description of the use case and proposed implementation.
coandco commentedon Aug 7, 2026
This would be very useful to me. I hope it gets merged.
yvonnedevlinrh commentedon Aug 27, 2026
+1 - hit this exact problem running
opencode runheadless in a restricted-egress sandbox (FullSend/OpenShell). Adding a concrete detail on the current v1.18.23 code path in case it helps scope the fix:In
packages/core/src/npm.ts,Npm.installalready fast-paths whennode_modulesis missing vs present, but whennode_modulesis present it still runs a "dirty check" (comparespackage.jsonagainstpackage-lock.json) and callsarborist.reify()- a network install - if any declared dep isn't in the lockfile. In an air-gapped/MITM'd-registry sandbox that reify fails (ECONNRESET), even though a satisfiednode_modulesis already baked into the image.OPENCODE_DISABLE_INSTALL=1as proposed (skip arborist entirely whennode_modulesexists; hard-error instead of silently attempting when missing) would fully cover this. Would love to see the branch land.kopecn commentedon Sep 27, 2026
Same here, openCode is littering node_modules almost everywhere. Is this intended behavior?