# Trouble Registering Custom Node

**URL:** <https://discourse.nodered.org/t/trouble-registering-custom-node/8237>\
**Category:** General\
**Created:** [21 February 2019 17:51 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237 "2019-02-21T17:51:27Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)\
**Post date:** [21 February 2019 17:51 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/1 "2019-02-21T17:51:27Z")

</div>

I have created a custom node .js and .html file along with a package.json empty file.

I execute **npm init** in the directory that contains the file and it creates the package.json as required.  
Next I run **npm install** in the same directory and it runs, no errors indicated.  
Next I shutdown Node Red and then restart it.

I refresh my Node Red page in the browser, but my custom node does not show up!

Also, I am running my Node Red on W10.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![cinhcet](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinhcet/32/438_2.png) [@cinhcet](https://discourse.nodered.org/u/cinhcet)\
**Post date:** [21 February 2019 19:01 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/2 "2019-02-21T19:01:58Z")

</div>

do you have the nodes registered in the package.json as per docs? [https://nodered.org/docs/creating-nodes/first-node#package-json](https://nodered.org/docs/creating-nodes/first-node#package-json)

---

<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:** [21 February 2019 19:26 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/3 "2019-02-21T19:26:43Z")

</div>

In what directory have you done all of that?

---

<div class="post-metadata">

**Author:** ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)\
**Post date:** [21 February 2019 19:29 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/4 "2019-02-21T19:29:44Z")

</div>

My directory is **.node-red\nodes\ss-modify-point-value**

my package.json  
{  
"name": "ss-modify-point-value",  
"version": "1.0.0",  
"description": "",  
"main": "ss-modify-point-value.js",  
"scripts": {  
"test": "echo "Error: no test specified" && exit 1"  
},  
"author": "",  
"license": "ISC",  
"node-red": {  
"nodes": {  
"ss-modify-point-value": "ss-modify-point-value.js"  
}  
}  
}

Does this help?

---

<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:** [21 February 2019 22:02 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/5 "2019-02-21T22:02:06Z")

</div>

Hi @tcontrada

as a side note, when sharing code of any sort, it helps to format it properly - this post explains how/why: [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

The `.node-red/nodes` directory is used to load local nodes that are not packaged as a module - so the package.json is ignored and it will load any .js/.html file pair it can find.

Are there any error messages in the log when you start Node-RED related to your node?

---

<div class="post-metadata">

**Author:** ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)\
**Post date:** [21 February 2019 22:39 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/6 "2019-02-21T22:39:11Z")

</div>

That's the funny thing, is that there are no errors in the Node Red console when starting. Here is the start message: There is a Warning message, but not sure if it's important?

# Welcome to Node-RED

21 Feb 17:36:52 - [info] Node-RED version: v0.19.5  
21 Feb 17:36:52 - [info] Node.js version: v10.13.0  
21 Feb 17:36:52 - [info] Windows\_NT 10.0.17134 x64 LE  
21 Feb 17:36:53 - [info] Loading palette nodes  
21 Feb 17:36:56 - [info] Dashboard version 2.13.2 started at /ui  
21 Feb 17:36:56 - [warn] rpi-gpio : Raspberry Pi specific node set inactive  
21 Feb 17:36:57 - [warn] ------------------------------------------------------  
21 Feb 17:36:57 - [warn] [node-red/tail] Not currently supported on Windows.  
21 Feb 17:36:57 - [warn] [node-red/ss-modify-point-value] Type already registered  
21 Feb 17:36:57 - [warn] [ss-modify-point-value/ss-modify-point-value] Type already registered  
21 Feb 17:36:57 - [warn] ------------------------------------------------------  
21 Feb 17:36:57 - [info] Settings file : \Users\tcontrada.node-red\settings.js  
21 Feb 17:36:57 - [info] Context store : 'default' [module=memory]  
21 Feb 17:36:57 - [info] User directory : \Users\tcontrada.node-red  
21 Feb 17:36:57 - [warn] Projects disabled : editorTheme.projects.enabled=false  
21 Feb 17:36:57 - [info] Flows file : \Users\tcontrada.node-red\flows\_TCONTRADALABLT.json  
21 Feb 17:36:57 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)  
21 Feb 17:36:57 - [warn]

* * *

Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials  
file will not be recoverable, you will have to delete it and re-enter  
your credentials.

## You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.

21 Feb 17:36:57 - [info] Starting flows  
21 Feb 17:36:57 - [info] Started flows  
21 Feb 17:36:57 - [info] serial port COM5 opened at 115200 baud 8N1  
21 Feb 17:36:57 - [info] serial port COM16 opened at 115200 baud 8N1  
21 Feb 17:36:57 - [info] serial port COM13 opened at 115200 baud 8N1  
21 Feb 17:36:57 - [info] serial port COM14 opened at 115200 baud 8N1

---

<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:** [21 February 2019 23:13 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/7 "2019-02-21T23:13:29Z")

</div>

> [@tcontrada](#):
>
> 21 Feb 17:36:57 - [warn] [node-red/ss-modify-point-value] Type already registered  
> 21 Feb 17:36:57 - [warn] [ss-modify-point-value/ss-modify-point-value] Type already registered

No, those warnings are exactly why your nodes don't show up. It could be because you have the package.json file there - as I said, you shouldn't add one under the `nodes` directory.

More commonly, you'd use `npm link` or similar to 'install' the nodes under `.node-red/node_modules` as if they were 'real' node modules.

---

<div class="post-metadata">

**Author:** ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)\
**Post date:** [22 February 2019 16:09 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/8 "2019-02-22T16:09:00Z")

</div>

Hi Nick,

At this point I am really confused. I have placed my .js and .html files in **.node-red\nodes\ss-modify-point-value** folder. I deleted the files from the **.node-red\node\_modules** folder.

So as you say Node Red should pick up my files in the **.node-red\nodes\ss-modify-point-value folder.**

But, I am still getting a Warning message saying **[warn] [node-red/ss-modify-point-value] Type already registered.**

What should I try now?

Thanks...

---

<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:** [22 February 2019 16:26 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/9 "2019-02-22T16:26:01Z")

</div>

Have a look in the file `.node-red/.config.json` for any mention of your nodes. That will tell you where the runtime has found them and may help clarify it for you.

As I mentioned before, I'd recommend packaging them as proper node modules and using `npm link` (as described in the docs) to install them under `.node-red/node_modules` and _not_ just place the files under `~/.node-red/nodes`.

---

<div class="post-metadata">

**Author:** ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)\
**Post date:** [22 February 2019 16:49 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/10 "2019-02-22T16:49:28Z")

</div>

So use this method?

On Windows with older versions of npm, use `mklink` instead:

```auto
cd C:\Users\my_name\.node_red
mklink /D node_modules\node-red-contrib-example-lower-case C:\Users\my_name\Documents\GitHub\node-red-contrib-example-lower-case

```

Where do I put my .js and .html files, in **node\_modules/my-custom-node**?

---

<div class="post-metadata">

**Author:** ![cinhcet](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinhcet/32/438_2.png) [@cinhcet](https://discourse.nodered.org/u/cinhcet)\
**Post date:** [22 February 2019 19:40 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/11 "2019-02-22T19:40:53Z")

</div>

another way is to put your .js and .html AND package.json (with the node-red entry specifying your nodes) into a folder, lets say `/home/user/nodeBla/my-custom-node`

Then you goto your node-red user directory and run `npm install /home/user/nodeBla/my-custom-node`

This will do something similar to npm link, but a little bit easier to work with. Refer to the npm documentation for details.

Oh, I just read that you are using an old version of npm, it could be that the method I described does not work then....

---

<div class="post-metadata">

**Author:** ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)\
**Post date:** [22 February 2019 21:00 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/12 "2019-02-22T21:00:16Z")

</div>

More issues:

If I try to use **link** I get the following message:  
**'link' is not recognized as an internal or external command,**  
**operable program or batch file.**

If I try to use **mklink** I get the following message:  
**You do not have sufficient privilege to perform this operation.**

I do have admin rights on this PC as well.

So now what?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [22 February 2019 21:10 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/13 "2019-02-22T21:10:41Z")

</div>

I also always do it the way @cinhcet suggests ... manually use npm install to point to a directory where I have a .js .html and package.json files (that is in my development directory away from main Node-RED install tree)

---

<div class="post-metadata">

**Author:** ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)\
**Post date:** [22 February 2019 21:30 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/14 "2019-02-22T21:30:04Z")

</div>

I am trying very hard to make this work. What bothers me is a month ago I was able to create custom nodes without difficulty, but now, for some reason I am having issues.

So when I run the npm install I get the following output:  
**npm WARN JSON.parse Failed to parse json**  
**npm WARN JSON.parse Unexpected end of JSON input while parsing near ''**

**+ red-contrib-modify-point-value@1.0.0**  
**added 3 packages and updated 1 package in 3.47s**

When I restart Node Red I get the following Warning:  
**[warn] [red-contrib-modify-point-value/ss-modify-point-value] Type already registered**

The node does not show up on the palette.

---

<div class="post-metadata">

**Author:** ![cinhcet](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinhcet/32/438_2.png) [@cinhcet](https://discourse.nodered.org/u/cinhcet)\
**Post date:** [22 February 2019 21:33 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/15 "2019-02-22T21:33:55Z")

</div>

show your package.json here. Please use tripple backticks as described here [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)\
**Post date:** [22 February 2019 21:35 UTC](https://discourse.nodered.org/t/trouble-registering-custom-node/8237/16 "2019-02-22T21:35:22Z")

</div>

```auto
{
  "name": "red-contrib-modify-point-value",
  "version": "1.0.0",
  "description": "",
  "main": "ss-modify-point-value.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "node-red" : {
        "nodes": {
            "ss-modify-point-value": "ss-modify-point-value.js"
        }
    },
  "author": "",
  "license": "ISC"
}

```
