Skip to content
MoveWorkflows

npm packages in n8n after Pipedream

Updated 2026-10-21 · 3 min read

Check a code step for the n8n Code node
Runs in your browser. The code is not sent anywhere.
In short
  • On n8n Cloud the Code node can load only crypto and moment.
  • Self-hosted: extend the n8nio/runners image, then allow-list in n8n-task-runners.json.
  • The Code node accepts only require(), so every Pipedream import line is rewritten.
On this page · 6 sections
  1. What to do now
  2. What n8n allows
  3. Self-hosted n8n 2.x: install and allow-list
  4. Pipedream habits that don't carry over
  5. Alternatives to npm
  6. How many of your steps are affected?

npm packages are the biggest practical difference between Pipedream and n8n. In Pipedream you wrote import _ from "lodash" and Pipedream installed the package for you. You needed no package.json (Pipedream docs). In n8n, external modules in the Code node are off by default. On n8n Cloud they are impossible. On self-hosted instances they are a deliberate setup step.

What to do now

  1. List your npm imports. The free report shows every package per workflow and per step. Check my export
  2. Replace what you can. HTTP clients and SDKs often become n8n nodes. See the table further down.
  3. Pick Cloud or self-hosted. Check your npm list before you choose. If packages remain, you need self-hosted n8n or a rewrite of the code.
  4. On self-hosted, extend the runner image. Install the packages there and allow-list them in n8n-task-runners.json.

What n8n allows

Setup Built-in Node modules (fs, path…) npm packages
n8n Cloud Only crypto Only moment
Self-hosted, external task runners, default config crypto moment
Self-hosted, internal mode, nothing set Blocked Blocked
Self-hosted, allow-listed The ones you list The ones you install and list

Sources: the n8n Code node docs ("If you use n8n Cloud, you can't import external npm modules"), enable modules, and the default n8n-task-runners.json in the runners image.

Self-hosted n8n 2.x: install and allow-list

In n8n 2.x every Code node runs in a task runner. A task runner is the separate process n8n uses to run Code node code. n8n recommends external mode. That means a sidecar container from the n8nio/runners image next to n8nio/n8n, with matching versions (task runner docs). You install and allow-list packages on the runner, not on the main n8n container.

1. Extend the runners image. You need version 1.121.0 or later.

FROM n8nio/runners:<same version as your n8nio/n8n>
USER root
RUN cd /opt/runners/task-runner-javascript && pnpm add lodash date-fns
COPY n8n-task-runners.json /etc/n8n-task-runners.json
USER runner

2. Allow-list the packages in the launcher config n8n-task-runners.json. The default file is locked down. Its env-overrides decide what the runner sees. So a plain environment variable on the container is not enough.

{
  "task-runners": [
    {
      "runner-type": "javascript",
      "env-overrides": {
        "NODE_FUNCTION_ALLOW_BUILTIN": "crypto",
        "NODE_FUNCTION_ALLOW_EXTERNAL": "moment,lodash,date-fns"
      }
    }
  ]
}

The example above is shortened. Start from the default file shipped in the image and edit only these keys.

3. Restart both containers. Then test a Code node with const _ = require('lodash');.

You can also run task runners in internal mode. n8n calls this mode "insecure by design" and plans to deprecate it in n8n 3.0. In internal mode the runner is a child process of the main container, and the environment variables go there.

Pipedream habits that don't carry over

  • Version pins in the import. Pipedream accepted import axios from "axios@0.19.2". In n8n you pin the version when you run pnpm add in the image. The code then imports by plain name.
  • ES import syntax. Pipedream steps use import. The n8n Code node accepts only require(). An import statement fails with a syntax error, so you rewrite every import line.
  • One version per instance. In n8n you install packages once in the runner image. So all workflows share one version of each package.

Alternatives to npm

Often you don't need the package at all:

Package used in Pipedream n8n replacement
axios, got, node-fetch, @pipedream/platform HTTP Request node
lodash (simple helpers) Plain JavaScript
moment Allowed on Cloud too. Or Luxon expressions ($now, DateTime)
@slack/web-api, googleapis, stripe The n8n app node, or HTTP Request with a credential
crypto Allowed on n8n Cloud and in the default external runner config
uuid require('crypto').randomUUID()

Swapping SDK calls for n8n nodes has a side benefit. Your credentials live in n8n's encrypted store instead of in your code.

How many of your steps are affected?

Our free report reads your export in your browser and lists every npm package per workflow and per step. To test a single step, paste it into the Code node compatibility check. It shows what works on n8n Cloud and what needs self-hosted n8n.

More reading:

Not affiliated with Pipedream or n8n.

FAQ

Can I use npm packages in n8n Cloud?

No. On n8n Cloud the Code node can load only two modules, crypto and moment. For anything else, self-host n8n, use an n8n node instead, or rewrite the code.

How do I enable npm packages on self-hosted n8n?

With external task runners, extend the n8nio/runners image (1.121.0 or later) and install the package with pnpm. Then allow-list it under NODE_FUNCTION_ALLOW_EXTERNAL in the launcher config file n8n-task-runners.json.

What is NODE_FUNCTION_ALLOW_BUILTIN?

It allow-lists Node.js built-in modules such as fs or path for the Code node. Use * for all. The default external task runner config allows crypto, and moment as an external module. Internal mode allows nothing unless you set it.

Do I need to install axios in n8n?

Usually not. Replace axios calls with the HTTP Request node, which also handles credentials and pagination.