eval-js

n8n nodes for evaluating JavaScript code

Package Information

Downloads: 90 weekly / 90 monthly
Latest Version: 0.1.1
Author: Michał Białek

Documentation

n8n-nodes-eval-js

A simple Evaluate JS community node for n8n that lets you execute arbitrary JavaScript against each item in a workflow. It is useful when you need to transform data, compute new values or run custom logic that isn't covered by built‑in nodes.

The node runs code in a sandboxed async function and expects a JSON object result for each item. You can drag values from other nodes (e.g. {{$('Previous Node').json.value}}) directly into the expression editor.

n8n is a fair‑code licensed workflow automation platform.


Installation

  1. In your n8n instance, go to Settings → Community Nodes.
  2. Install from npm by entering n8n-nodes-eval-js or by uploading the .tgz built with npm pack.
  3. Alternatively, clone this repository into your n8n custom nodes folder and restart n8n.

Once installed, the Evaluate JS node will appear under the Developer Tools category.

Usage

  1. Add Evaluate JS to your workflow and connect it to a previous node.
  2. In the Expressions field, write your JavaScript code. The following variables are available:
    • $json – the current item's JSON data
    • $binary – binary data if present
    • $item, $itemIndex, $input, $node, $parameter – helpers from n8n's workflow data proxy
  3. Your script must return a plain object, e.g. return { foo: $json.bar * 2 };.
  4. To insert values from other nodes, open the expression editor (gear icon) or drag fields directly into the code editor.

Example

// multiply the "amount" field by 100 and add a timestamp
return {
  amountCents: $json.amount * 100,
  processedAt: new Date().toISOString(),
};

If an error occurs and Continue On Fail is enabled, the original item will be forwarded with an error property.

Compatibility

  • Tested with n8n v0.210.0 and later.
  • Requires Node.js >=18 (same as n8n itself).

Development

# install dependencies
npm install

# build once
npm run build

# or start dev server (auto rebuild + live preview)
npm run dev

Resources

License

MIT © Michał Białek


Version history will be maintained in changelog.

Discussion