As an alternative to running n8n directly from npm, or rebuilding a Docker image, if you are running w/ docker-compose, from the directory where docker-compose.yml is…
mkdir extralibs
cd extralibs
npm init
npm i dbf-node
cd ..
edit docker-compose.yml
add volumes to n8n service for each additional npm lib…
volumes:
- ./extralibs/node_modules/dbf-node:/usr/local/lib/node_modules/n8n/node_modules/dbf-node
- ...etc / other transitive dependencies...
Couldn’t say whether this is an appropriate way to do this for a production deployment, but it seems to do the trick just to see if you can get a code node working with the extra libraries.
I think you also still need to have NODE_FUNCTION_ALLOW_EXTERNAL=* in the environment.
It would probably be helpful to get the dbf related code working outside of n8n before trying to get it to work in a code node. Debugging info and error messages will be a lot easier without n8n wrapped around it.