-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
Bug
The brainstorm visual companion server (skills/brainstorming/scripts/server.js) fails to start on Node.js v24+ because server.js uses CommonJS require() but package.json declares "type": "module".
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".
To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
Environment
- OS: Windows 11 (Git Bash / MSYS2)
- Node.js: v24.7.0
- Superpowers: 5.0.4
- Claude Code: latest
Steps to Reproduce
- Have Node.js 24+ installed
- Start a brainstorming session that uses the visual companion
- Server silently fails — no
.server-info, no.server.log(in foreground mode), or error in.server.log(in background mode)
Root Cause
package.json at the superpowers root has "type": "module". Node.js 24 strictly enforces this: all .js files in the package are treated as ESM. But server.js uses require(), module.exports, etc. (CommonJS).
This likely worked on older Node.js versions that were more lenient, or before "type": "module" was added to package.json.
Fix
Rename server.js → server.cjs and update references in start-server.sh (lines 112 and 118):
- env ... node server.js
+ env ... node server.cjsThe .cjs extension forces CommonJS regardless of package.json settings.
Workaround
Applied locally in the plugin cache:
cp scripts/server.js scripts/server.cjs
sed -i 's/node server\.js/node server.cjs/g' scripts/start-server.shThis workaround is lost when the plugin cache is refreshed.