Skip to content

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

@reinaldoluckman

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.jsserver.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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions