Skip to content

Windows: OpenCode fails to start - Cannot find module '@openauthjs/openauth/pkce' #6935

@jqbdyhz

Description

@jqbdyhz

Description

When running opencode-cli.exe auth login on Windows, selecting "OpenCode Zen" provider causes an error:

error: Cannot find module '@openauthjs/openauth/pkce' from 'C:\Users\...\.cache\opencode\node_modules\opencode-anthropic-auth\index.mjs'

Root Cause

The @openauthjs/openauth package (version 0.4.3) has an incomplete npm release:

  • package.json declares exports: "./*": { "import": "./dist/esm/*.js" }
  • But the dist/esm/ directory does not exist in the published package
  • Only dist/types/ and src/ are present

When opencode-anthropic-auth tries to import from @openauthjs/openauth/pkce, module resolution fails.

Environment

  • OS: Windows 11 x64
  • OpenCode CLI version: 1.0.164 (from desktop installer at D:\OpenCode)
  • Also reproduced with pnpm-installed [email protected]

Workaround

Manually create the missing file at:
~/.cache/opencode/node_modules/@openauthjs/openauth/dist/esm/pkce.js

With a self-contained PKCE implementation (base64url encode + SHA-256 challenge generation).

Suggested Fix

Either:

  1. Pin @openauthjs/openauth to a version that includes dist/esm/ in the published package
  2. Or update opencode-anthropic-auth to use a different import path that exists

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions