You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Visual companion server.js fails on Node.js v25+ (ESM/CommonJS conflict) #774
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
Have Node.js v25+ installed
Start a brainstorming session that triggers the visual companion
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.jsontype field.
Alternatively, the server script could be rewritten to use ESM imports.
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!
Activity
obra commentedon Mar 17, 2026
Fixed by renaming
server.js→server.cjsso Node.js treats the brainstorming server as CommonJS regardless of the rootpackage.json"type": "module"setting. Cherry-picked from PR #784 by @sarbojitrana to the dev branch. Thanks @reinaldoluckman for reporting!