# Run Any NPM or PyPI Package in n8n Using YepCode

Date review:  Aug 1, 2025

---

**n8n’s built-in nodes are powerful, but what happens when you need something specific that doesn’t exist?**  
That’s where YepCode comes in. Unlike other no-code platforms that limit you to predefined functions, YepCode lets you run **any NPM or PyPI package** with custom JavaScript or Python code directly in your n8n workflows.

> **The key differentiator:** You’re not limited to built-in functions or a curated list of packages. If it’s on npm or PyPI, you can run it.

## What is the Run Code Operation?

The **Run Code** operation is YepCode’s most flexible feature in n8n. It allows you to:

- **Run custom JavaScript or Python code** directly in your workflow
- **Use any NPM package** (for JavaScript) or **any PyPI package** (for Python)
- **Transform data** with complex logic that would require multiple n8n nodes
- **Call APIs** that don’t have native n8n integrations
- **Process files** and handle binary data
- **Run AI-generated code** on the fly

## Setup Prerequisites

To use YepCode’s Run Code operation in n8n, you’ll need:

1. A [YepCode account](https://cloud.yepcode.io/)
2. An n8n Cloud account or self-hosted n8n installation

For detailed setup instructions, check out our [complete n8n integration guide](/content/blog/n8n-yepcode-combined-build-amazing-workflows/index.html).

### Setting up YepCode credentials

To connect n8n with YepCode, you’ll need to create API credentials:

1. In your YepCode account, go to **Settings > API Keys**
2. Create a new API key with appropriate permissions
3. In n8n, when configuring the YepCode node, click **“Create New”** under credentials
4. Enter your YepCode API key
5. Test the connection to ensure everything works

> **Need help with the full setup?** Check out our [complete n8n integration guide](/content/blog/n8n-yepcode-combined-build-amazing-workflows/index.html) for detailed step-by-step instructions.

## Complete Example: Data Processing

Let’s walk through a complete example that shows all the key concepts. This example processes n8n data using the Luxon date library:

```
// Import any npm package - YepCode will install it automatically

const { DateTime } = require("luxon");

const { n8n } = yepcode.context.parameters;

const results = [];

for (const item of n8n.items) {

results.push({

...item.json,

processedAt: DateTime.now().toISO(),

});

}

// Access n8n metadata - check all available fields at: https://docs.n8n.io/code/builtin/n8n-metadata/

console.log("Environment:", n8n.metadata);

console.log("Resume URL:", n8n.metadata["$execution"].resumeUrl);

return results;
```

### Breaking Down the Example

**1. Package Import:**

```
const { DateTime } = require("luxon");
```

- YepCode automatically installs any npm package you require
- No need to manage dependencies or package.json files
- Just use `require()` or `import` and it works

If you are connecting to some private service (API’s, databases, storage systems, etc.), do not include any sensitive information in the code, use YepCode [Team Variables](/content/docs/processes/team-variables/index.html) instead.

**2. Accessing n8n Data:**

```
const { n8n } = yepcode.context.parameters;
```

- All n8n data is available through `yepcode.context.parameters.n8n`
- `n8n.items` contains the data from previous nodes
- Each item has a `json` property with the actual data

**3. Processing Data:**

```
const results = [];

for (const item of n8n.items) {

results.push({

...item.json,

processedAt: DateTime.now().toISO(),

});

}
```

- Loop through each item from the previous n8n node
- Use the Luxon library to add timestamps
- Return the processed data for the next node

**4. Accessing n8n Metadata:**

```
console.log("Environment:", n8n.metadata);

console.log("Resume URL:", n8n.metadata["$execution"].resumeUrl);
```

- Access execution metadata, environment variables, and more
- Useful for debugging and conditional logic
- Full documentation available at [n8n metadata docs](https://docs.n8n.io/code/builtin/n8n-metadata/)

**5. Returning Results:**

```
return results;
```

- The returned data becomes available to the next n8n node
- Can return objects, arrays, or any JSON-serializable data

## When to Use Run Code

**Use Run Code when:**

- You need quick, one-off transformations
- You want to run specific packages not available elsewhere
- You’re prototyping or testing ideas
- The logic is simple and doesn’t need versioning

> **Note:** For reusable business logic with version control and team collaboration, consider using YepCode’s Run Process operation instead.

> **📚 Official Documentation:** For the complete technical reference, visit the [YepCode n8n node repository](https://github.com/yepcode/n8n-nodes-yepcode?tab=readme-ov-file#2-run-code) on GitHub.

## Conclusion

The Run Code operation transforms n8n from a no-code platform into a **no-code + full-code hybrid**. You get the visual workflow benefits of n8n with the unlimited power of running any package.

**Ready to unlock unlimited automation possibilities?** Start with the example above and see how YepCode can revolutionize your n8n workflows.

Happy coding! 🚀
