Skip to content

bug: Leftover dot-prefixed temp directory in global node_modules breaks npm -g update on Windows #4592

@SHJordan

Description

@SHJordan

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

  1. Install opencode-ai globally on Windows (npm i -g opencode-ai).
  2. (Trigger condition unclear, possibly during install or first run).
  3. Observe a directory like .opencode-ai-xxxxxx in %APPDATA%\npm\node_modules.
  4. Run npm -g update.

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Warp + pwsh 7

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions