Need help getting started with nodem

71 views
Skip to first unread message

Kevin Toppenberg

unread,
May 9, 2025, 6:43:27 PMMay 9
to Everything MUMPS
Hey all, I would like to play around with the nodem interface between nodejs and yottadb.

My goal is to create a web page that allows user to enter some information, and it will get stored in the yottadb database.   Using chatgpt, I have a server.js that gets user info and saves to a flat file.  I would like to change that to save to the database.

I have found the github page for nodem here: https://github.com/dlwicksell/nodem?tab=readme-ov-file 

My current test folder for my node project is /opt/worldvista/EHR/web/killthis   I changed into this directory and typed npm install nodem.

I then started nodejs and at the prompt entered this:

>const ydb = require('nodem').Ydb();

But it generates an error, as below.

> const ydb = require('nodem').Ydb();
Error: The module '/opt/worldvista/EHR/web/killthis/node_modules/nodem/build/Release/nodem.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 127. This version of Node.js requires
NODE_MODULE_VERSION 109. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Module._extensions..node (node:internal/modules/cjs/loader:1452:18)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/opt/worldvista/EHR/web/killthis/node_modules/nodem/lib/nodem.js:42:22)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)

Try rebuilding Nodem with 'npm run install' in the /opt/worldvista/EHR/web/killthis/node_modules/nodem directory

Uncaught TypeError: require(...).Ydb is not a function
>
(To exit, press Ctrl+C again or Ctrl+D or type .exit)
>

I changed to /opt/worldvista/EHR/web/killthis/node_modules/nodem

I tried recompiling, and everything seems to go OK, as below.

kdt0p@ubuntu64:/opt/worldvista/EHR/web/killthis/node_modules/nodem$ npm run install

> no...@0.20.9 preinstall
> bash -o pipefail -c "node lib/preinstall |& tee builderror.log"


> no...@0.20.9 install
> bash -o pipefail -c "node-gyp -j max rebuild 3>&1 1>&2 2>&3 3>&- | tee -a builderror.log"

gyp info it worked if it ends with ok
gyp info using node...@10.1.0
gyp info using no...@22.2.0 | linux | x64
gyp info find Python using Python version 3.12.3 found at "/usr/bin/python3"

gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/home/kdt0p/.nvm/versions/node/v22.2.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/opt/worldvista/EHR/web/killthis/node_modules/nodem/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/kdt0p/.nvm/versions/node/v22.2.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/kdt0p/.cache/node-gyp/22.2.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/kdt0p/.cache/node-gyp/22.2.0',
gyp info spawn args '-Dnode_gyp_dir=/home/kdt0p/.nvm/versions/node/v22.2.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/kdt0p/.cache/node-gyp/22.2.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/opt/worldvista/EHR/web/killthis/node_modules/nodem',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 6 ]
make: Entering directory '/opt/worldvista/EHR/web/killthis/node_modules/nodem/build'
  CXX(target) Release/obj.target/nodem/src/nodem.o
  CXX(target) Release/obj.target/nodem/src/gtm.o
  CXX(target) Release/obj.target/nodem/src/ydb.o
  SOLINK_MODULE(target) Release/obj.target/nodem.node
  COPY Release/nodem.node
make: Leaving directory '/opt/worldvista/EHR/web/killthis/node_modules/nodem/build'
gyp info ok

> no...@0.20.9 postinstall
> bash -o pipefail -c "node lib/postinstall 3>&1 1>&2 2>&3 3>&- | tee -a builderror.log"

But when I retry
>const ydb = require('nodem').Ydb();
I get the same error.

Can someone point me in the correct direction?

Thanks
Kevin

David Wicksell

unread,
May 9, 2025, 8:06:39 PMMay 9
to Everything MUMPS
It looks like you have more than one version of Node.js installed, and are compiling Nodem with a newer version
and then running it with an older version. Do a `whereis node` to see if you can find all the versions installed. Also,
contact me offline and I can help you.

David Wicksell
Fourth Watch Software LC

Kevin Toppenberg

unread,
May 11, 2025, 7:04:37 PMMay 11
to Everything MUMPS
I get this.


kdt0p@ubuntu64:~$ whereis node
node: /usr/bin/node /usr/include/node /home/kdt0p/.nvm/versions/node/v22.2.0/bin                      /node /usr/share/man/man1/node.1.gz

kdt0p@ubuntu64:~$ which node
/home/kdt0p/.nvm/versions/node/v22.2.0/bin/node

I'll contact you offline as well.

Kevin

Kevin Toppenberg

unread,
May 16, 2025, 12:36:51 PMMay 16
to Everything MUMPS
With David's help, I was able to remove one of the node installations so there was no duplicate. 

I also followed the instructions for configuration.  After rebooting the server, it works!  Great!

KT

Rob Tweed

unread,
Jun 1, 2025, 6:15:26 AMJun 1
to Everything MUMPS
If you're looking into Node.js (and also check out Bun.js) integration with YottaDB, rather than reinvent all the wheels, take a look at what's already been created here:

Kevin Toppenberg

unread,
Jun 1, 2025, 5:57:47 PMJun 1
to Everything MUMPS
Thank you David and also Rob.   I need some time to digest all this.  I post back later.

Kevin
Reply all
Reply to author
Forward
0 new messages