Installing the external module carbone.io

Hello community!

I’m trying to start using the https://www.npmjs.com/package/carbone document generator.
Installed using “npm install -g carbone” command.
The example code for the test uses the following variable ( const fs = require(‘fs’) ), which, as far as I understand, should refer to the “fs” dependency built into NodeJs.
It gives me an error (see screenshot).
I understand that there is nothing in this “fs” path, but what should be the correct path in this case?
Or is the problem something else?

Hi @Roket, you’d need to specifically allow the use of modules in n8n. You can allow a built-in module using the NODE_FUNCTION_ALLOW_BUILTIN environment variable and external modules using NODE_FUNCTION_ALLOW_EXTERNAL.

So once you set NODE_FUNCTION_ALLOW_BUILTIN=fs, you should be able to require fs in your Function code.

1 Like

@MutedJam Thanks! Its works.

1 Like