# Node module update issue

**URL:** https://discourse.nodered.org/t/node-module-update-issue/2799
**Category:** General
**Created:** [3 September 2018 09:57 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799 "2018-09-03T09:57:55Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![waqaslam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waqaslam/32/2271_2.png) [@waqaslam](https://discourse.nodered.org/u/waqaslam)
#### Post date: [3 September 2018 09:57 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/1 "2018-09-03T09:57:56Z")

</div>

Hi  
I'm trying to update **node-red-node-email** from Node-red's manage pallete section, but it throws error that the module is not installed locally.  
So after reading forums I found out that I need to see where my module is initially installed and for that I ran the command **npm ls -g node-red-node-email** which returned the following result:

![Screenshot%20from%202018-09-03%2012-01-30](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1272e0c69f7c70db0e49c508ecbef1c6c796cce3.png)

However, when I install the module globally (as per forums instructions) with the command **sudo npm ls -g node-red-node-email** and re-run the **npm ls -g node-red-node-email** command, so the hierarchy ends up like this:

> ```
> /usr/lib
> ├─┬ node-red@0.19.2
> │ └── node-red-node-email@0.1.29 
> └── node-red-node-email@1.0.1
> ```

So, my question is, why do I end up with two different instances of same module? and where exactly is ver 1.0.1 residing?

Also, how can I fix this? (preferably by removing the old version)

Thanks

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [3 September 2018 10:11 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/2 "2018-09-03T10:11:31Z")

</div>

Just answered this in another thread

It is a good idea to read the install notes for a node - see the last line.

## Install

Version 0.x of this node is usually installed by default by Node-RED. To install version 1.x you need to uninstall the existing version.

```auto
    sudo npm uninstall -g node-red-node-email

```

Then run the following command in your Node-RED user directory - typically `~/.node-red`

```auto
    npm i node-red-node-email

```

**Note :** this installs the new version locally rather than globally. This can then be managed by the palette manager.

---

<div class="post-metadata">

### Author: ![waqaslam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waqaslam/32/2271_2.png) [@waqaslam](https://discourse.nodered.org/u/waqaslam)
#### Post date: [3 September 2018 10:59 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/3 "2018-09-03T10:59:21Z")

</div>

Uninstalling the module with the command leaves back to the following state:

![Screenshot%20from%202018-09-03%2012-01-30](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1272e0c69f7c70db0e49c508ecbef1c6c796cce3.png)

Seems like the command only removes **node-red-node-email@1.0.1** , though **node-red-node-email@0.1.29** module is still present.

---

<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: [3 September 2018 11:18 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/4 "2018-09-03T11:18:22Z")

</div>

that’s the version of Node-RED (0.19.2) not any email node

---

<div class="post-metadata">

### Author: ![waqaslam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waqaslam/32/2271_2.png) [@waqaslam](https://discourse.nodered.org/u/waqaslam)
#### Post date: [3 September 2018 11:20 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/5 "2018-09-03T11:20:13Z")

</div>

my bad, I fixed the typo.  
how can I uninstall **node-red-node-email@0.1.29**?

---

<div class="post-metadata">

### Author: ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)
#### Post date: [3 September 2018 11:23 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/6 "2018-09-03T11:23:08Z")

</div>

> [@waqaslam](#):
>
> my bad, I fixed the typo.  
> how can I uninstall **node-red-node-email@0.1.29**?

I had to remove the folder manually:

`sudo rm -r /usr/lib/node_modules/node-red/node_modules/node-red-node-email`

where my npm root is:

```auto
npm root -g

```

```auto
/usr/lib/node_modules
```

---

<div class="post-metadata">

### Author: ![waqaslam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waqaslam/32/2271_2.png) [@waqaslam](https://discourse.nodered.org/u/waqaslam)
#### Post date: [3 September 2018 11:26 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/7 "2018-09-03T11:26:52Z")

</div>

Is it safe to delete the folder rather than uninstalling the module properly?  
I mean, doesn't npm keep track of modules installed and later complain when missing without uninstalling?

---

<div class="post-metadata">

### Author: ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)
#### Post date: [3 September 2018 11:30 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/8 "2018-09-03T11:30:07Z")

</div>

Well I first did the uninstall but the folder hasn't been removed!

---

<div class="post-metadata">

### Author: ![waqaslam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waqaslam/32/2271_2.png) [@waqaslam](https://discourse.nodered.org/u/waqaslam)
#### Post date: [3 September 2018 11:41 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/9 "2018-09-03T11:41:15Z")

</div>

Unfortunately, in my case, the folder isn't empty.

---

<div class="post-metadata">

### Author: ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)
#### Post date: [3 September 2018 11:41 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/10 "2018-09-03T11:41:54Z")

</div>

which folder?

---

<div class="post-metadata">

### Author: ![waqaslam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waqaslam/32/2271_2.png) [@waqaslam](https://discourse.nodered.org/u/waqaslam)
#### Post date: [3 September 2018 11:42 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/11 "2018-09-03T11:42:44Z")

</div>

> [@cflurin](#):
>
> node-red-node-email

**/usr/lib/node\_modules/node-red/node\_modules/node-red-node-email**

---

<div class="post-metadata">

### Author: ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)
#### Post date: [3 September 2018 11:46 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/12 "2018-09-03T11:46:56Z")

</div>

Ok, here is what I did:

`sudo npm uninstall -g node-red-node-email`

`sudo rm -r /usr/lib/node_modules/node-red/node_modules/node-red-node-email`

`cd ~/.node-red`

`npm i node-red-node-email`

this way the node-red-node-email is installed in the `.node-red` folder.

---

<div class="post-metadata">

### Author: ![waqaslam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waqaslam/32/2271_2.png) [@waqaslam](https://discourse.nodered.org/u/waqaslam)
#### Post date: [3 September 2018 11:57 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/13 "2018-09-03T11:57:39Z")

</div>

I'm not fully convinced with deleting the module folder part. This is what I did:  
**sudo npm uninstall -g node-red-node-email**  
and it outputs:  
**up to date in 0.038s**  
which means uninstall did nothing.  
later I called:  
**sudo npm ls -g node-red-node-email**  
and it outputs:

```
/usr/lib
└─┬ node-red@0.19.2
  └── node-red-node-email@0.1.29
```

then I removed the module folder as you suggested:  
**sudo rm -r /usr/lib/node\_modules/node-red/node\_modules/node-red-node-email**  
and re-printed the module status, and this time I get the following:  
 ![Screenshot%20from%202018-09-03%2013-53-39](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/7623fa16461422e6a8d6c2e564664412999b995d.png)

As I pointed earlier, node-red keeps track of installed modules and deleting the module-folder just like that doesn't seem the right way.

---

<div class="post-metadata">

### Author: ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)
#### Post date: [3 September 2018 12:02 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/14 "2018-09-03T12:02:19Z")

</div>

I know that, probably because of the node-red package.json dependency  
`"node-red-node-email": "0.1.*",`

But if you go on installing the node locally in `./node-red` and restart node-red, what happens?

---

<div class="post-metadata">

### Author: ![waqaslam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waqaslam/32/2271_2.png) [@waqaslam](https://discourse.nodered.org/u/waqaslam)
#### Post date: [3 September 2018 12:08 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/15 "2018-09-03T12:08:49Z")

</div>

_Installing module:_

> ```
> waqas@aslam:~/.node-red$ npm i node-red-node-email
> npm WARN deprecated mailparser@0.6.2: Mailparser versions older than v2.3.0 are deprecated
> npm WARN deprecated mimelib@0.3.1: This project is unmaintained
> + node-red-node-email@1.0.1
> added 19 packages from 12 contributors in 1.47s
> ```

_Showing local listing:_

> ```
> waqas@aslam:~/.node-red$ sudo npm ls node-red-node-email
> node-red-project@0.0.1 /home/waslam/.node-red
> └── node-red-node-email@1.0.1
> ```

_Showing global listing:_

> ```
> waqas@aslam:~/.node-red$ sudo npm ls -g node-red-node-email
> /usr/lib
> └─┬ node-red@0.19.2
> └── UNMET DEPENDENCY node-red-node-email@0.1.*
> 
> npm ERR! missing: node-red-node-email@0.1.*, required by node-red@0.19.2
> ```

Looks like my global listing is messed up.

---

<div class="post-metadata">

### Author: ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)
#### Post date: [3 September 2018 12:11 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/16 "2018-09-03T12:11:33Z")

</div>

did you restart node-red and check the `node-red-node-email` version?

---

<div class="post-metadata">

### Author: ![waqaslam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/waqaslam/32/2271_2.png) [@waqaslam](https://discourse.nodered.org/u/waqaslam)
#### Post date: [3 September 2018 13:13 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/17 "2018-09-03T13:13:47Z")

</div>

It looks fine in node-red UI with correct version.

Seems like I've fixed the global listing issue by removing

> **"node-red-node-email": "0.1.\*",**

from **package.json** file in **/usr/lib/node\_modules/node-red**

and now this is what I get when print global listing:

> ```
> /usr/lib
> └── (empty)
> ```

which means there's no such package installed globally.

---

<div class="post-metadata">

### Author: ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)
#### Post date: [3 September 2018 13:22 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/18 "2018-09-03T13:22:28Z")

</div>

I did also remove the dependency but I think we should ask @knolleary or @dceejay for the best praxis.  
Maybe update `package.json`?

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [3 September 2018 14:24 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/19 "2018-09-03T14:24:43Z")

</div>

I wonder if you need to do a `remove` not `uninstall`

---

<div class="post-metadata">

### Author: ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)
#### Post date: [3 September 2018 14:31 UTC](https://discourse.nodered.org/t/node-module-update-issue/2799/20 "2018-09-03T14:31:17Z")

</div>

I'm not sure I undestand you.  
I just did an uninstall following the doc but actually it doesn't uninstall (probably because it's installed in the node-red path) so I've removed the folder with all the included files manually.

[Next page](https://discourse.nodered.org/t/node-module-update-issue/2799.md?page=2)
