# Custom nodes cannot be installed to Node-Red

**URL:** <https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368>\
**Category:** General\
**Created:** [17 August 2018 16:29 UTC](https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368 "2018-08-17T16:29:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![malinthasa](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@malinthasa](https://discourse.nodered.org/u/malinthasa)\
**Post date:** [17 August 2018 16:29 UTC](https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368/1 "2018-08-17T16:29:19Z")

</div>

Hi,

I am creating and installing nodes programmatically. I tested this application on Ubuntu OS and it worked correctly. Then I tried this application in another Ubuntu installation and there my node is not get installed. Let me show my code briefly. I am creating a folder and required files and then install that package as npm module.

```
fs.mkdirSync('my_node';'0777');
//writing files into the created folder
//install node using following command
exec('npm install --prefix ~/.node-red my_node').then(.....;{

```

I can see the `my_node` folder in`./node-red/node_modules` folder which has `lrwxrwxrwx 1` permission. (folder has shortcut mark on its icon). I opened the package.json file of node-red found in `./node-red/` folder. I can see my node has been added as a dependency. But on the machine where this node is installed fine, I cannot see that dependency.

```
{
    "name": "node-red-project",
    "description": "A Node-RED Project",
    "version": "0.0.1", 
   "dependencies": {
        "my_node":"file:../path/to/original/folder/which/is/created_using_mkdir"
   }
}

```

1. What is the reason for getting dependency entry for my custom node? I think this is due to some problem.
2. My code is working fine in one machine but not on others. Is this due to any version related problem of the installation?

Appreciate your insight to solve this issue.

---

<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:** [17 August 2018 17:07 UTC](https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368/2 "2018-08-17T17:07:35Z")

</div>

What versions of node.js and npm are you using on both machines?

---

<div class="post-metadata">

**Author:** ![malinthasa](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@malinthasa](https://discourse.nodered.org/u/malinthasa)\
**Post date:** [20 August 2018 09:38 UTC](https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368/3 "2018-08-20T09:38:50Z")

</div>

Hi,

Please find the versions of softwares on two machines.

**Working fine -**

npm version - 3.5.2  
nodejs version - 8.10.0  
node-red version - 0.18.7

**Not Working -**

npm version - 6.1.0  
nodejs version - 10.6.0  
node-red version - 0.18.7

Regards,  
Malintha

---

<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 August 2018 09:42 UTC](https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368/4 "2018-08-20T09:42:06Z")

</div>

> [@malinthasa](#):
>
> What is the reason for getting dependency entry for my custom node? I think this is due to some problem.

You are running very different versions of npm on your two machines, which explains the difference in behaviour you are seeing.

`npm` changed its behaviour at version 5 - it now adds anything you install to your package file by default.

---

<div class="post-metadata">

**Author:** ![malinthasa](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@malinthasa](https://discourse.nodered.org/u/malinthasa)\
**Post date:** [20 August 2018 10:45 UTC](https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368/5 "2018-08-20T10:45:41Z")

</div>

Thank you for the response. I downgraded `npm` and `nodejs` to exact versions which are working fine. Now, I can see my custom node folder inside `./node-red/node_modules` folder (without that shortcut mark icon) and nothing has been added to the `package.json`. Now, the problem not appearing the installed custom nodes on node-red UI. I am not sure about how node-red UI renders available node list. I found an entry for my custom node in `.config.js` file

```
"myNode": {
   "name": "myNode",
   "version": "1.0.0",
   "local": true,
   "nodes": {
"myNode": {
 "name": "myNode",
 "types": [
  "myNode"
 ],
 "enabled": true,
 "local": true,
 "module": "myNode",
 "file": "/home/malintha/.node-red/node_modules/myNode/myNode.js"
}
   }
  },

```

First I installed my custom node (with few other custom nodes) programmatically. Then I tried installing one node manually using

`npm install --prefix ~/.node-red myNode`

and I could see the 'successfully installed' log message along with the already installed custom nodes list.

Why can't I see my custom nodes on node-red UI?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [20 August 2018 10:58 UTC](https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368/6 "2018-08-20T10:58:51Z")

</div>

is there anything written to the node-red log when you restart node-red?

---

<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 August 2018 11:30 UTC](https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368/7 "2018-08-20T11:30:16Z")

</div>

Have you restarted Node-RED?

---

<div class="post-metadata">

**Author:** ![malinthasa](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@malinthasa](https://discourse.nodered.org/u/malinthasa)\
**Post date:** [20 August 2018 14:27 UTC](https://discourse.nodered.org/t/custom-nodes-cannot-be-installed-to-node-red/2368/8 "2018-08-20T14:27:47Z")

</div>

Looking at the startup log, I found and required dependency missing issue and installing it solves subsequent issues.
