Description
The plugin hooks fail on Node.js v24 because the compiled JS uses __dirname, which is not available in ES modules. Since package.json has "type": "module", Node 24 treats .js files as ESM and __dirname is undefined.
This causes the smart installer (smart-install.js) to crash silently on session start, so dependencies never get installed. The stop.js hook then fails with MODULE_NOT_FOUND because node_modules is missing.
Error
ReferenceError: __dirname is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension
and package.json contains "type": "module".
at file:///.../.claude/plugins/marketplaces/memvid/dist/hooks/smart-install.js:18:68
Steps to Reproduce
- Install Node.js v24
- Install the plugin via Claude Code
- Start a new Claude Code session
- The session-start hook crashes, deps are never installed
- The stop hook fails with
Cannot find module 'proper-lockfile'
Suggested Fix
Replace __dirname with the ESM equivalent:
import { fileURLToPath } from "url";
import { dirname } from "path";
const __dirname = dirname(fileURLToPath(import.meta.url));
Or use import.meta.dirname (available in Node 21+).
Environment
- Node.js: v24.14.0
- Plugin version: 1.0.11
Description
The plugin hooks fail on Node.js v24 because the compiled JS uses
__dirname, which is not available in ES modules. Sincepackage.jsonhas"type": "module", Node 24 treats.jsfiles as ESM and__dirnameis undefined.This causes the smart installer (
smart-install.js) to crash silently on session start, so dependencies never get installed. Thestop.jshook then fails withMODULE_NOT_FOUNDbecausenode_modulesis missing.Error
Steps to Reproduce
Cannot find module 'proper-lockfile'Suggested Fix
Replace
__dirnamewith the ESM equivalent:Or use
import.meta.dirname(available in Node 21+).Environment