{"id":27033,"library":"gtm","title":"m.js: GT.M binding for Node.js","description":"Node.js binding to the GT.M hierarchical (MUMPS) database. The current version is 0.1.0-56-g1b5486c (pre-release from git). The package wraps the GT.M C API to allow Node.js to read and write to GT.M global nodes. It uses GNP (GT.M Network Protocol) or direct call-in. Key differentiator: it is the only Node.js binding for GT.M with native bindings, but it is experimental and uses a pre-1.0 version. It requires GT.M to be installed and configured.","status":"active","version":"0.1.0-56-g1b5486c","language":"javascript","source_language":"en","source_url":"git://github.com/OSEHRA-Sandbox/m.js","tags":["javascript","M","MUMPS","database","hierarchical database","databases","NoSQL","GT.M"],"install":[{"cmd":"npm install gtm","lang":"bash","label":"npm"},{"cmd":"yarn add gtm","lang":"bash","label":"yarn"},{"cmd":"pnpm add gtm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Native Abstractions for Node.js required to compile the C++ binding.","package":"nan","optional":false}],"imports":[{"note":"Package does not support ES modules; use CommonJS require.","wrong":"import gnp from 'gtm';","symbol":"gnp","correct":"const gnp = require('gtm');"},{"note":"close is a named export; require returns the module object.","wrong":"const { close } = require('gtm').close;","symbol":"close","correct":"const { close } = require('gtm');"},{"note":"open is a top-level function, not a method on a default export.","wrong":"const gtm = require('gtm'); gtm.open();","symbol":"open","correct":"const { open } = require('gtm');"},{"note":"set is exported from the main module, not a subpath.","wrong":"const { set } = require('gtm/set');","symbol":"set","correct":"const { set } = require('gtm');"},{"note":"Both forms work, but the named destructuring is idiomatic.","wrong":"const get = require('gtm').get;","symbol":"get","correct":"const { get } = require('gtm');"}],"quickstart":{"code":"const gtm = require('gtm');\nconst conn = gtm.open({host: process.env.GTM_HOST ?? '127.0.0.1', port: process.env.GTM_PORT ?? 1234, namespace: process.env.GTM_NAMESPACE ?? 'DEFAULT'});\ngtm.set(conn, '^MyGlobal(\"key1\")', 'value1');\nconst val = gtm.get(conn, '^MyGlobal(\"key1\")');\nconsole.log(val);\ngtm.close(conn);\nconn.close();","lang":"javascript","description":"Connects to a GT.M instance, sets and retrieves a global node, then closes the connection."},"warnings":[{"fix":"Install GT.M (e.g., gtm, gt.m-devel) and node-gyp. Ensure GTM_DIST environment variable is set.","message":"Native addon requires GT.M development headers and Node.js build tools; fails to install or load without them.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Use exact version from git tag or local copy if registry version is outdated.","message":"Package version uses git describe format (0.1.0-56-g1b5486c); npm registry may have different versioning.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Make sure GT.M is running with proper GNP configuration (port, namespace).","message":"open() requires a fully configured GT.M listener; no default parameters work out of the box.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use Node.js <=0.12; or fork and update nan/binding to modern N-API.","message":"Incompatible with Node.js versions beyond 0.12 due to deprecated V8 API usage.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Ensure global names start with ^ and subscripts are comma-separated in the string.","message":"set() and get() use global reference syntax; not following GT.M syntax causes runtime errors.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Recompile the addon: npm rebuild gtm or use node-gyp rebuild.","cause":"The compiled native addon is not compatible with the current Node.js version.","error":"Error: Module did not self-register."},{"fix":"Install node-gyp and required build tools, then run: node-gyp configure build within the module directory.","cause":"Missing or incorrectly built native module; package installation did not compile.","error":"Error: Could not locate the bindings file."},{"fix":"Install the package: npm install gtm and use const gtm = require('gtm');","cause":"Using require incorrectly or package not installed.","error":"ReferenceError: gtm is not defined"},{"fix":"Start GT.M with GNP listener: gtm_gnp_server -PORT=1234 -SERVICE=^DEFAULT","cause":"GT.M listener not running or wrong host/port.","error":"Error: connect ECONNREFUSED 127.0.0.1:1234"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}