# Module\_not\_found error for local node, but not for released node

**URL:** <https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238>\
**Category:** Developing Nodes\
**Created:** [18 November 2024 23:15 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238 "2024-11-18T23:15:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe-AB1DO](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@Joe-AB1DO](https://discourse.nodered.org/u/Joe-AB1DO)\
**Post date:** [18 November 2024 23:15 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/1 "2024-11-18T23:15:13Z")

</div>

Hi all,

I have written a node and released updates several times without issue. Now I want to update the module some more, but it has been a while. Anyway, long story short, when I use palette manager to install my node there are no issues. However, when I clone my github repository to my local RPi4 to modify the code (using VSCode) and try to install the modified node locally, suddenly I get the following error:

```auto
Welcome to Node-RED
===================
18 Nov 16:50:53 - [info] Node-RED version: v3.0.2
18 Nov 16:50:53 - [info] Node.js version: v16.20.2
18 Nov 16:50:53 - [info] Linux 6.1.21-v8+ arm LE
18 Nov 16:50:55 - [info] Loading palette nodes
redPlc rpi_mcp23008 driver V1.0.6 (c) Ocean iiot2k@gmail.com
18 Nov 16:50:56 - [info] Dashboard version 3.2.0 started at /ui
18 Nov 16:50:56 - [warn] ------------------------------------------------------
18 Nov 16:50:56 - [warn] [@joe-ab1do/mcp-pcf-aio/mcp-pcf-aio] Error: Cannot find module 'i2c-bus'
Require stack:
- /home/pi/dev/MCP230xx-PCF857x-AIO/mcp-pcf-aio.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/lib/node_modules/node-red/lib/red.js
- /usr/lib/node_modules/node-red/red.js
18 Nov 16:50:56 - [warn] ------------------------------------------------------
18 Nov 16:50:56 - [info] Settings file : /home/pi/.node-red/settings.js
18 Nov 16:50:56 - [info] Context store : 'default' [module=memory]
18 Nov 16:50:56 - [info] User directory : /home/pi/.node-red
18 Nov 16:50:56 - [warn] Projects disabled : editorTheme.projects.enabled=false
18 Nov 16:50:56 - [info] Flows file : /home/pi/.node-red/flows.json
18 Nov 16:50:57 - [warn]
---------------------------------------------------------------------

```

The i2c-bus module is present in ~./node-red/node\_modules. To be sure, I did npm-remove i2c-bus followed by npm-install i2c-bus, but same result. The node-red palette shows Module\_Not\_Found.

Using the palette manager, I can remove the node and successfully install the old (current) version from npm. I don't understand why suddenly the i2c-bus module cannot be found for the local node. I have changed nothing in the .js file.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 November 2024 01:44 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/2 "2024-11-19T01:44:02Z")

</div>

How did you install local clone?

Did you run npm install inside the clone ?

---

<div class="post-metadata">

**Author:** ![Joe-AB1DO](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@Joe-AB1DO](https://discourse.nodered.org/u/Joe-AB1DO)\
**Post date:** [19 November 2024 15:10 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/3 "2024-11-19T15:10:59Z")

</div>

All I did was click on clone a repository using VScode. I installed it locally in ~/dev, a directory I had created. The directory was empty (newly created) prior to the clone install.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 November 2024 15:16 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/4 "2024-11-19T15:16:09Z")

</div>

> [@Joe-AB1DO](#):
>
> I installed it locally in ~/dev, a directory I had created.

Details please - surely you ran `npm install ~/dev/my-node-path` ?

> [@Steve-Mcl](#):
>
> Did you run npm install inside the clone ?

You also need to do this ☝

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 November 2024 16:26 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/5 "2024-11-19T16:26:36Z")

</div>

Also you need to restart node-red

---

<div class="post-metadata">

**Author:** ![Joe-AB1DO](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@Joe-AB1DO](https://discourse.nodered.org/u/Joe-AB1DO)\
**Post date:** [19 November 2024 16:53 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/6 "2024-11-19T16:53:12Z")

</div>

> [@Steve-Mcl](#):
>
> Details please - surely you ran `npm install ~/dev/my-node-path` ?

Yes. I cloned the repository to the local folder ~/dev which downloaded the existing .js, .html, etc files from my repository to the ~/dev/(name of my repository) folder. Then after making a few modifications in the .html file I went to ~/.node-red folder and ran npm install ~/dev/(name of repository).

> [@Steve-Mcl](#):
>
> Did you run npm install inside the clone ?

Don't know what this means. Can you elaborate?

---

<div class="post-metadata">

**Author:** ![Joe-AB1DO](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@Joe-AB1DO](https://discourse.nodered.org/u/Joe-AB1DO)\
**Post date:** [19 November 2024 16:54 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/7 "2024-11-19T16:54:31Z")

</div>

> [@Colin](#):
>
> Also you need to restart node-red

Yes, I would always run node-red-restart. Lately I have been running node-red-stop and node-red-start in succession, which would give me the log.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 November 2024 16:56 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/8 "2024-11-19T16:56:26Z")

</div>

> [@Joe-AB1DO](#):
>
> > [@Steve-Mcl](#):
> >
> > Did you run npm install inside the clone ?
> 
> Don't know what this means. Can you elaborate?

It is probably the reason for your error. You typically need to run NPM inside the repository to grab its own dependencies.

e.g.

```auto
cd ~/dev/repo-folder
npm install

```

This will install any dependencies the clone needs

---

<div class="post-metadata">

**Author:** ![Joe-AB1DO](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@Joe-AB1DO](https://discourse.nodered.org/u/Joe-AB1DO)\
**Post date:** [19 November 2024 17:07 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/9 "2024-11-19T17:07:55Z")

</div>

Yup, that did it 🙂

Thanks so much (again).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 December 2024 17:08 UTC](https://discourse.nodered.org/t/module-not-found-error-for-local-node-but-not-for-released-node/93238/10 "2024-12-03T17:08:23Z")

</div>

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