-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Description
The opencode-ai package appears to be creating a temporary directory (e.g., .opencode-ai-r3F0EMZ1) directly inside the global node_modules folder on Windows.
If this directory is not cleaned up, it causes all future global npm updates to fail with EINVALIDPACKAGENAME, as npm attempts to parse the dot-prefixed directory as a package.
Observed Error:
npm error code EINVALIDPACKAGENAME
npm error Invalid package name ".opencode-ai-r3F0EMZ1" of package ".opencode-ai-r3F0EMZ1@*": name cannot start with a period.
Root Cause Analysis
It seems the package (likely the postinstall script or the binary downloader) uses node_modules as a scratchpad for temporary extraction but fails to clean it up or ignore it. Since npm strictly validates folder names in node_modules during updates, this leftover artifact blocks standard npm maintenance commands.
Workaround:
Manually deleting the .opencode-ai-* directory restores npm functionality.
OpenCode version
1.0.85
Steps to reproduce
- Install opencode-ai globally on Windows (npm i -g opencode-ai).
- (Trigger condition unclear, possibly during install or first run).
- Observe a directory like .opencode-ai-xxxxxx in %APPDATA%\npm\node_modules.
- Run npm -g update.
Screenshot and/or share link
Operating System
Windows 11
Terminal
Warp + pwsh 7