Module did not self-register @serialport

I had to reinstall my raspberry pi zero

I copied the old ~/.node-red to the new, and then ran the update-script.
So I have the same flows as before.

I get this in the log:
foo - Error: Module did not self-register: '/home/pi/.node-red/node_modules/@serialport/bindings/build/Release/bindings.node'.

I'm using
node-red-contrib-serial-modbus v 0.0.11 to read my power-meter.
I can see in /dev/ that the usb modbus adapter appears when I plug it in, but I get no results from the power-meter.

Is modbus related to @serialport?

Is there a way to see if the modbus is being polled?

You should not have copied the .node-red/node_modules folder. Delete that folder, go into the .node-red folder, and run
npm install
Which will reinstall all additional nodes required.

Edit: Note that this may take quite a long time on a zero.

npm install dies on serialport

284 verbose pkgid @serialport/bindings@2.0.8
285 verbose cwd /home/pi/.node-red
286 verbose Linux 5.15.61+
287 verbose node v16.19.0
288 verbose npm  v8.19.3
289 error code 1
290 error path /home/pi/.node-red/node_modules/serialport/node_modules/@serialport/bindings
291 error command failed
292 error command sh -c -- prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
293 error make: Entering directory '/home/pi/.node-red/node_modules/serialport/node_modules/@serialport/bindings/build'
293 error   CXX(target) Release/obj.target/bindings/src/serialport.o
293 error make: Leaving directory '/home/pi/.node-red/node_modules/serialport/node_modules/@serialport/bindings/build'
294 error gyp info it worked if it ends with ok
294 error gyp info using node-gyp@9.1.0
294 error gyp info using node@16.19.0 | linux | arm
294 error gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
294 error gyp info spawn /usr/bin/python3
294 error gyp info spawn args [
294 error gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
294 error gyp info spawn args   'binding.gyp',
294 error gyp info spawn args   '-f',
294 error gyp info spawn args   'make',
294 error gyp info spawn args   '-I',
294 error gyp info spawn args   '/home/pi/.node-red/node_modules/serialport/node_modules/@serialport/bindings/build/config.gypi',
294 error gyp info spawn args   '-I',
294 error gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
294 error gyp info spawn args   '-I',
294 error gyp info spawn args   '/home/pi/.cache/node-gyp/16.19.0/include/node/common.gypi',
294 error gyp info spawn args   '-Dlibrary=shared_library',
294 error gyp info spawn args   '-Dvisibility=default',
294 error gyp info spawn args   '-Dnode_root_dir=/home/pi/.cache/node-gyp/16.19.0',
294 error gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
294 error gyp info spawn args   '-Dnode_lib_file=/home/pi/.cache/node-gyp/16.19.0/<(target_arch)/node.lib',
294 error gyp info spawn args   '-Dmodule_root_dir=/home/pi/.node-red/node_modules/serialport/node_modules/@serialport/bindings',

Post the full output please.

Did you install build-essential?

I did a npm install serialport in ~pi

then I could do a npm install in ~pi/nodered, and it's working now.

That would not have made any difference. All it will have done is to install it into ~/node_modules and created package files in ~