Node libuuid.so.1 not found

I’m a NixOS noob, still feeling my way. I’ve been writing NextJS and Svelte apps, and figured out today how to get Jupyter/Python/Pandas working, but now am running into a problem with a simple node script. It is failing at const { createCanvas } = require("canvas");. The error is Error: libuuid.so.1: cannot open shared object file: No such file or directory. I have libuuid installed, as well as nodejs. I am not using flakes nor home manager.

I’m a little confused about how node package dependencies are handled in NixOS perhaps. So far, Svelte and NextJS apps have acted as usual, creating the package.json and node_modules directories as normal. Now I’m doing a NodeJS script and don’t quite understand the behavior. (p)npm install does not create a package.json or lockfile or anything like that, nor does it create a node_modules directory. I assume this is normal from what I read on the Wiki. I don’t quite understand how this works, but pnpm says everything is up to date.

But I am getting the above error. Is this a PATH issue? I’m at a loss here.
I did use a flake for the first time to set up jupyter so if that’s a solution to this problem I’d be happy with that.


Edit: It was a PATH issue. I found the library and prepended LD_LIBRARY_PATH=/nix/store/…, which got me to the next error:

Error: The module '/home/biscotty/node_modules/.pnpm/canvas@2.11.2/node_modules/canvas/build/Release/canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 120. This version of Node.js requires
NODE_MODULE_VERSION 108. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

I thought these were provided by nodePackages.pnpm (I had been using nodPackages_latest.pnpm, but tried it with the plain .pnpm with no different result.) I tried pnpm rebuild which seemed to do something, but I ended up with the same error. If I understand correctly. Trying with just npm fails with 11508 error Cannot read properties of null (reading 'matches')

My configuration.nix includes

    nodejs_20
    nodePackages.npm
    nodePackages_latest.pnpm