How do I set ENV Variables in n8n cloud?

I use the cloud instance of n8n and want to use moment.js. Can you let me know how I can enable external modules in the cloud instance?

Hi @Bala_Panneerselvam, I am afraid it’s currently not possible to import external Node.js modules in n8n.cloud (as it will always run the “vanilla” version of n8n) or set environment variables.

That said, you can execute any JavaScript code through the Function (or Function Item) node and this would include the Moment.js code. Here’s an example but this includes the really bad eval() method which should always be avoided (so best to see this as a proof of concept rather than a suggestion):

Going forward, you might want to leave a vote at Externally hosted nodes which covers externally hosted code.

Appreciate the response, thanks.

1 Like

To follow up on this: We’re currently checking whether we can open up the use of Moment.js specifically on n8n.cloud for users and will make sure to keep you updated on the progress :slight_smile:

1 Like