EDIT: I was able to do this without a custom node by using npm install jsbarcode, then setting the environment variable in my docker-compose.yml file as NODE_FUNCTION_ALLOW_EXTERNAL=jsbarcode.
Finally, in the same file, under volumes I added this to the list:
- /root/node_modules/jsbarcode:/usr/local/lib/node_modules/jsbarcode.
Then I rebuilt all docker containers using docker compose stop and running
docker compose up --force-recreate --build -d.
I used this post to assist on this one.
This made it possible to use const jsbarcode = require('jsbarcode'); in the Code node.