# Using local node for development & testing

**URL:** <https://discourse.nodered.org/t/using-local-node-for-development-testing/15179>\
**Category:** Developing Nodes\
**Created:** [5 September 2019 21:51 UTC](https://discourse.nodered.org/t/using-local-node-for-development-testing/15179 "2019-09-05T21:51:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![clickworkorange](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/clickworkorange/32/12109_2.png) [@clickworkorange](https://discourse.nodered.org/u/clickworkorange)\
**Post date:** [5 September 2019 21:51 UTC](https://discourse.nodered.org/t/using-local-node-for-development-testing/15179/1 "2019-09-05T21:51:39Z")

</div>

I wanted to make a small change to the "Smooth" node, so I forked [node-red-nodes](https://github.com/node-red/node-red-nodes) on GitHub and checked out my fork to a local directory. I had installed NodeJS on my development machine (Devuan ASCII) with `sudo apt-get install -t ascii-backports npm` to end up with npm 5.8.0 and NodeJS 8.11.1, then installed Node-RED with `sudo npm install -g --unsafe-perm node-red`, giving me Node-RED 0.20.7. I then linked my local copy of node-red-nodes by executing `sudo npm link ../Sources/node-red-nodes/` in my ~/.node-red directory. This _seemed_ to work (although did result in a few vulnerability warnings for some of node-red-nodes' dependencies), but after restarting Node-RED I still cannot find the "Smooth" node in the list.

TL;DR: How should I set up my Node-RED instance for local development and testing of a module like node-red-nodes?

**Edit:** Hmm. `npm link` didn't do what I expected here; the symlink doesn't point to my development copy of node-red-nodes, but rather

```auto
$ ls -la ~/.node-red/node_modules
lrwxrwxrwx 1 root root 53 Sep 5 22:37 node-red-nodes -> ../../../../usr/local/lib/node_modules/node-red-nodes

```

That's no good.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [5 September 2019 22:03 UTC](https://discourse.nodered.org/t/using-local-node-for-development-testing/15179/2 "2019-09-05T22:03:50Z")

</div>

Hi @clickworkorange

the node-red-nodes repo contains many nodes, it is not a module you use npm link with at its top level.

You can use the npm link from within the smooth node's own subdirectory - in this instance `node-red-nodes/function/smooth`

---

<div class="post-metadata">

**Author:** ![clickworkorange](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/clickworkorange/32/12109_2.png) [@clickworkorange](https://discourse.nodered.org/u/clickworkorange)\
**Post date:** [5 September 2019 22:06 UTC](https://discourse.nodered.org/t/using-local-node-for-development-testing/15179/3 "2019-09-05T22:06:22Z")

</div>

Ah. That makes sense, thanks. But how do I make `npm link` symlink to my development directory rather than try to copy it to `/usr/local/lib/node_modules/`?

**Edit** : Hang on, maybe that's a symlink too... wheels within wheels...  
**Edit** : Yep, symlink to symlink

```auto
/home/me/.node-red/node_modules/node-red-node-smooth -> /usr/local/lib/node_modules/node-red-node-smooth -> /home/me/Sources/node-red-nodes/function/smooth

```

We are cooking with gas.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [5 September 2019 22:09 UTC](https://discourse.nodered.org/t/using-local-node-for-development-testing/15179/4 "2019-09-05T22:09:56Z")

</div>

Depending on your version of npm (ie 5.x or later... preferably 6.x), then rather than use `npm link` you could do:

```auto
cd ~/.node-red/
npm install /full/path/to/node-red-nodes/function/smooth

```

and it will do the Right Thing

That saves polluting your global npm space as well.
