Skip to content

Visual companion server.js fails on Node.js v25+ (ESM/CommonJS conflict) #774

Closed

Description

@reinaldoluckman

Bug Description

The brainstorming visual companion server fails to start on Node.js v25+ with:

ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and
'.../superpowers/5.0.4/package.json' contains "type": "module".

Root Cause

skills/brainstorming/scripts/server.js uses CommonJS (require()), but the root package.json declares "type": "module". Node.js v25 enforces this strictly — all .js files under a "type": "module" package are treated as ESM, causing require() to throw.

Steps to Reproduce

  1. Have Node.js v25+ installed
  2. Start a brainstorming session that triggers the visual companion
  3. Server fails with the error above

Fix

Rename server.js → server.cjs and update the two node server.js invocations in start-server.sh to node server.cjs. The .cjs extension forces CommonJS mode regardless of the package.json type field.

Alternatively, the server script could be rewritten to use ESM imports.

Environment

  • Node.js: v25.8.1
  • Superpowers: v5.0.4
  • Platform: macOS (Darwin 25.3.0)

Activity

  1. obra commented on Mar 17, 2026

    @obra
    Owner

    Fixed by renaming server.js → server.cjs so Node.js treats the brainstorming server as CommonJS regardless of the root package.json "type": "module" setting. Cherry-picked from PR #784 by @sarbojitrana to the dev branch. Thanks @reinaldoluckman for reporting!

  2. added
    bug
    on Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions