# Custom node in docker container throwing "cannot find module" error

**URL:** <https://community.n8n.io/t/custom-node-in-docker-container-throwing-cannot-find-module-error/5940>\
**Category:** Questions\
**Tags:** deployment\
**Created:** [May 24, 2021, 9:06am UTC](https://community.n8n.io/t/custom-node-in-docker-container-throwing-cannot-find-module-error/5940 "2021-05-24T09:06:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![itd24](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/itd24/32/4198_2.png) [@itd24](https://community.n8n.io/u/itd24)\
**Post date:** [May 24, 2021, 9:06am UTC](https://community.n8n.io/t/custom-node-in-docker-container-throwing-cannot-find-module-error/5940/1 "2021-05-24T09:06:39Z")

</div>

Hi 🙂 ,

I needed a customized Twitter node, so I copied the original and adapted it for my purposes. I set up the development environment by creating a Docker container, cloning the n8n repository and adding my custom node to the package.json. Everything worked as expected, the node was visible and working correctly.

n8n is running in a separate container along with some other containers, all orchestrated by docker-compose. I used “n8nio/n8n”.

As far as I know, I had to map the path, where my compiled container is, to the path “/root/.n8n/custom/”. This seems to work and the custom node is being picked up. The problem I got is that n8n crashes because it does not find the required dependencies:

" **Error: There was an error: Cannot find module ‘n8n-core’".**

This error happens in the file “GenericFunctions.js”. I checked and “n8n-core” is installed globally inside the container (just like it should be since I did not alter the Docker container in any way, I just mapped the required volumes).

The compiled javascript looks ok to me:

```
const n8n_core_1 = require("n8n-core");
const n8n_workflow_1 = require("n8n-workflow");
async function twitterApiRequest(method, resource, body = {}, qs = {}, uri, option = {}) {

```

Is there anything I missed? Do I have to install the required dependencies locally in my Node?

Any clue would be greatly appreciated 🙂

---

<div class="post-metadata">

**Author:** ![krazyjakee](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/krazyjakee/32/4894_2.png) [@krazyjakee](https://community.n8n.io/u/krazyjakee)\
**Post date:** [May 24, 2021, 11:12pm UTC](https://community.n8n.io/t/custom-node-in-docker-container-throwing-cannot-find-module-error/5940/2 "2021-05-24T23:12:09Z")

</div>

I have the same issue with cheerio. I’d like for nodes in .n8n/custom to have access to dependencies of n8n.

---

<div class="post-metadata">

**Author:** ![itd24](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/itd24/32/4198_2.png) [@itd24](https://community.n8n.io/u/itd24)\
**Post date:** [May 25, 2021, 6:57pm UTC](https://community.n8n.io/t/custom-node-in-docker-container-throwing-cannot-find-module-error/5940/4 "2021-05-25T18:57:51Z")

</div>

I was able to make it work by installing all dependencies locally.  
Sadly it does not find the globally installed packages, so I just installed all dependencies, including “n8n-core” and “n8n-workflow” locally for each custom node.  
Keep in mind that when copying the nodes to the custom directory, you also have to include the local “npm\_modules” folder with all required dependencies.

---

<div class="post-metadata">

**Author:** ![lemining](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lemining/32/6033_2.png) [@lemining](https://community.n8n.io/u/lemining)\
**Post date:** [August 5, 2021, 9:48am UTC](https://community.n8n.io/t/custom-node-in-docker-container-throwing-cannot-find-module-error/5940/5 "2021-08-05T09:48:45Z")

</div>

@itd24 I can confirm this is the only way I could get my node to work which is a little bit dissapointing.
