Skip to content

brainstorming server.js fails with ESM error due to package.json "type": "module" #783

@david46liu

Description

@david46liu

Bug Description

skills/brainstorming/scripts/server.js uses CommonJS syntax (require(), module.exports) but package.json declares "type": "module", causing Node.js to treat all .js files as ES modules.

Error

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".

Steps to Reproduce

  1. Install the superpowers plugin (v5.0.4)
  2. Trigger the brainstorming skill which calls start-server.sh
  3. The script runs node server.js which fails immediately

Environment

  • Windows 11, Git Bash
  • Node.js v22.17.1
  • superpowers v5.0.4

Workaround

Rename server.jsserver.cjs and update the two references in start-server.sh (lines 112 and 118) from node server.js to node server.cjs.

Suggested Fix

Either:

  1. Rename server.js to server.cjs and update start-server.sh (minimal change)
  2. Or convert server.js to ESM syntax (import instead of require, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions