# Documentation: testing a node module locally

**URL:** <https://discourse.nodered.org/t/documentation-testing-a-node-module-locally/262>\
**Category:** General\
**Created:** [20 May 2018 21:07 UTC](https://discourse.nodered.org/t/documentation-testing-a-node-module-locally/262 "2018-05-20T21:07:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [20 May 2018 21:07 UTC](https://discourse.nodered.org/t/documentation-testing-a-node-module-locally/262/1 "2018-05-20T21:07:01Z")

</div>

I have found two different recipes for this in the NR documentation, one at  
[[https://nodered.org/docs/creating-nodes/packaging](https://nodered.org/docs/creating-nodes/packaging)]  
and the other at  
[[https://nodered.org/docs/creating-nodes/first-node](https://nodered.org/docs/creating-nodes/first-node)].  
I have had success with the second but not the first. The one given under Packaging appears to be the instructions from Creating your first node for older versions of npm, except that `npm link` is used instead of `ln -s` or `mklink`. It might be a good idea to smooth out the differences and put the information in just one place, with cross-references if needed.

---

<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:** [20 May 2018 22:32 UTC](https://discourse.nodered.org/t/documentation-testing-a-node-module-locally/262/2 "2018-05-20T22:32:18Z")

</div>

When you say you haven’t had success with the instructions under packaging, do you mean you had to use `ln` or `mklink` rather than `npm link`? What version of `npm` were you using and on what platform?

Given how quickly `npm` is moving, I’d expect `npm link` to work for most users now.

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [20 May 2018 23:15 UTC](https://discourse.nodered.org/t/documentation-testing-a-node-module-locally/262/3 "2018-05-20T23:15:25Z")

</div>

Sorry I wasn’t clear about what I did. I tried the Packaging instructions, which mention only `npm link`. IIRC, I ended up with a link to somewhere odd, possibly /usr/bin. I may also have made an error specifying `<name of node module>`, possibly as file not a directory. I tried this at various times over the past year or so, running current Raspbian and npm versions.

In any case, I simply cleaned up the mess and went back to putting .js and .html files in a subdirectory of `~./node-red/nodes`. Very recently I found the other set of directions and had success with `npm install`, so I can’t say whether `npm link` would work for me.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [21 May 2018 10:00 UTC](https://discourse.nodered.org/t/documentation-testing-a-node-module-locally/262/4 "2018-05-21T10:00:09Z")

</div>

`npm link` creates an intermediary link that I personally find unnecessary and confusing.

When I’m developing a new node, I simply create a new GitHub repo, clone it to my dev PC in my development folder (e.g. not under node-red) then manually create a link from the dev folder to the correct location under my `userDir`.

for example, if I created a new node called `node-red-contrib-myidea`, it would be cloned to something like `c:\src\node-red-contrib-myidea` and then I would create a softlink from there to `~/.node-red/node_modules/node-red-contrib-myidea` (note that the tilde for your home folder only works under PowerShell on Windows).

This works perfectly well and npm handles linked folders just fine. It means that I don’t have to mess with doing `npm update` when changing my code - though, of course, you still have to restart Node-RED.
