# How to setup external node\_modules in hosted version?

**URL:** <https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019>\
**Category:** Questions\
**Tags:** node-module\
**Created:** [October 25, 2022, 9:37am UTC](https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019 "2022-10-25T09:37:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdings](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mdings/32/10895_2.png) [@mdings](https://community.n8n.io/u/mdings)\
**Post date:** [October 25, 2022, 9:37am UTC](https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019/1 "2022-10-25T09:37:57Z")

</div>

I’m running my n8n instance on a self-hosed environment inside DigitalOcean. Inside the `code` node I would like to use the [Mollie Api client](https://github.com/mollie/mollie-api-node) to charge payments. From the [docs](https://docs.n8n.io/hosting/configuration/#use-built-in-and-external-modules-in-the-code-node), I understand I should first allow n8n to execute external modules. Below is an outline of steps I took to make this work, however without success.

Log into DigitalOcean, open the console as root

- `export NODE_FUNCTION_ALLOW_EXTERNAL=*`
- `cd n8n && npm init -y && npm i -S @mollie/api-client`
- `docker-compose down`
- `docker-compuse up -d`

While executing the code below inside the node, I get the `not found` error: ERROR: `Cannot find module '@mollie/api-client' [line 1, for item 0]`

```auto
const { createMollieClient } = require('@mollie/api-client')
console.log(createMollieClient)

```

Does anyone know how to make this work?

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [October 25, 2022, 9:47am UTC](https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019/2 "2022-10-25T09:47:55Z")

</div>

Hi @mdings, this looks like you have installed the npm module on your host machine rather than inside your n8n docker container. So, if you are using docker to run n8n and you would like to install additional npm modules you’d need to create a custom docker image for n8n that includes the npm packages you’re looking into.

Unfortunately, I don’t have a ready-to-run example at the moment (our docker images have changed a lot recently), but [n8n/docker/images/n8n-custom at master · n8n-io/n8n (github.com)](https://github.com/n8n-io/n8n/tree/master/docker/images/n8n-custom) should be a solid base for your customization.

---

<div class="post-metadata">

**Author:** ![mdings](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mdings/32/10895_2.png) [@mdings](https://community.n8n.io/u/mdings)\
**Post date:** [October 25, 2022, 9:55am UTC](https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019/3 "2022-10-25T09:55:05Z")

</div>

Thanks, I’ll look into that. I’m not that familiar with docker & docker-compose, just followed the docs on the website to get it up and running. So if you have more direct examples of how to install node/npm and dependencies inside a docker container, I’d be happy to hear those!

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [October 25, 2022, 9:59am UTC](https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019/4 "2022-10-25T09:59:26Z")

</div>

Tbf, I would suggest you avoid adding node modules only to interact with a REST API like [this one](https://docs.mollie.com/index). It’ll mean you’d have to maintain your own Dockerfile continuously in order to reflect any changes to n8n, which can be a pain.

Perhaps you might instead want to consider simply using the existing HTTP Request node to interact with the API in question? Looking at [the example](https://docs.mollie.com/overview/authentication#authenticating-an-api-call) from the documentation it can be as simple as making a GET request to a URL such as `https://api.mollie.com/v2/payments/tr_WDqYK6vllg` with an `Authorization` header with a value of `Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM`. That’s something the HTTP Request node should handle nicely.

---

<div class="post-metadata">

**Author:** ![mdings](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mdings/32/10895_2.png) [@mdings](https://community.n8n.io/u/mdings)\
**Post date:** [October 25, 2022, 11:06am UTC](https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019/5 "2022-10-25T11:06:25Z")

</div>

That’s an excellent consideration. I’ve been using the SDK in my own Netlify webhooks but wanted to consolidate all logic into one place. I guess I overlooked the possibility to use the direct endpoint there 😀  
All go for that option, thanks for the pointers @MutedJam!

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [October 25, 2022, 11:11am UTC](https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019/6 "2022-10-25T11:11:38Z")

</div>

No worries! If you hit any errors or limitations give me a shout 🙂

---

<div class="post-metadata">

**Author:** ![mdings](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mdings/32/10895_2.png) [@mdings](https://community.n8n.io/u/mdings)\
**Post date:** [October 25, 2022, 5:47pm UTC](https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019/7 "2022-10-25T17:47:06Z")

</div>

Btw can I use multiple entry points inside a workflow?

In the example below I have a cron job that takes all payments that should be handled. Inside the HTTP request there is a parameter called webhook URL which is called by the payment provider with the status of the payment.  
That webhook URL should then handle any statuses from the payment, for example send a confirmation message whenever the payment succeeded. It would be nice to have those entries inside the same workflow since they’re closely related. While testing I need to disable the webhook otherwise n8n will wait for the hook to be called, while the upper flow with the cron entry should be run. Will this work when moving to “production”?

 ![flow](https://europe1.discourse-cdn.com/n8n/original/3X/f/f/ff6db926178e2b29b89a3772196d6738ea819254.png)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [November 1, 2022, 5:47pm UTC](https://community.n8n.io/t/how-to-setup-external-node-modules-in-hosted-version/19019/8 "2022-11-01T17:47:55Z")

</div>

Closed on November 1, 2022, 5:47pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
