You need to create a custom image that has that library installed. Then you have to the env variable NODE_FUNCTION_ALLOW_EXTERNAL with the name of the package.
It is theoretically also possible with the docker image but much more messy as you have to mount each module you need separate. For “sugar-date” that would for example additionally be “sugar-core” as “sugar-'date” depends on it. The more complex the module you need the more modules that would be. So for it to work you would have to:
npm install “sugar-date” (or whatever you want) in a folder (in this example it would be ~/whereever-you-have-the-module)
Then start the n8n container kind of like…