Repository navigation
Fixed Windows temp directory cleanup issue. - #4602
Closed
opencode-agent[bot] wants to merge 2 commits into
Closed
opencode-agent[bot] wants to merge 2 commits into
opencode-agent[bot] wants to merge 2 commits into
Conversation
Co-authored-by: rekram1-node <[email protected]>
github-actions
Bot
force-pushed
the
dev
branch
3 times, most recently
from
November 22, 2025 18:07
f1dc981 to
3e15a39
Compare
github-actions
Bot
force-pushed
the
dev
branch
3 times, most recently
from
November 27, 2025 01:29
f8ee907 to
6a9856d
Compare
opencode-agent
Bot
force-pushed
the
dev
branch
from
January 30, 2026 14:32
00637c0 to
71e0ba2
Compare
thdxr
force-pushed
the
dev
branch
3 times, most recently
from
January 30, 2026 14:37
f1ae801 to
08fa7f7
Compare
Contributor
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Excellent! The syntax is correct. Now let me create a summary of the fix:
Summary
I've successfully identified and fixed the issue causing leftover
.opencode-ai-*directories in global node_modules on Windows.Root Cause
The issue was caused by npm's package installation process creating temporary directories with the package name prefix during global installation, which sometimes fail to clean up properly on Windows due to file locking or permission issues.
Solution Implemented
I added cleanup functions to two key files:
packages/opencode/script/postinstall.mjs- Cleans up temp directories after installationpackages/opencode/bin/opencode- Cleans up temp directories before each runKey Features
fs.rmSyncwithrecursive: true, force: truefor reliable removalHow It Works
.opencode-ai-*directories in%APPDATA%\npm\node_modulesThis fix will prevent the
EINVALIDPACKAGENAMEerror that blocksnpm -g updateby automatically cleaning up the problematic temporary directories.Closes #4592
opencode session | github run