# Sort out node installed globally

**URL:** <https://discourse.nodered.org/t/sort-out-node-installed-globally/17507>\
**Category:** General\
**Created:** [4 November 2019 21:42 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507 "2019-11-04T21:42:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [4 November 2019 21:42 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/1 "2019-11-04T21:42:02Z")

</div>

Having recently installed an instance of @TotallyInformation alternate install on my Win 10 machine, I noticed that the Blocky node (node-red-contrib-blockly) came with it.

Julian has pointed out to me that he doesn't supply any nodes pre-installed and that I probably installed it globally in the past

Since I was a beta tester, this is quite likely

I'm wondering what is the best way to resolve this situtation without mucking up my main standard Node-RED install running on same Win machine

Its complicated by the fact that I'm running V1.2.0 of the node from github and not the standard npm 1.1.0 version

---

<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:** [5 November 2019 00:20 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/2 "2019-11-05T00:20:32Z")

</div>

There is no magic to npm modules.

If you remove global modules but still need to use one, you would need to install locally. Same as you are doing with Node-RED itself.

Modules are contained by a folder with an entry in a package.json

Bottom line is that you should just do a `npm remove -g node-red-contrib-blockly`, restart node-red and see if the blockly node still turns up.

If you really get stuck, you can search your drive(s) for `node_module` folders and find any sub-folders called `node-red-contrib-blockly` and just delete them.

If you break something, you can just install the node again.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [5 November 2019 07:37 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/3 "2019-11-05T07:37:09Z")

</div>

> [@TotallyInformation](#):
>
> There is no magic to npm modules.

well npm is dark arts to me 🙂

i did the global un-install but the node didn't disappear from the alternate install so I'm now hunting it down thru my file system but I've a feeling this is going to take some time 🙂

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/78dfbbd9db97ae99c5185f18fdcb2b1e274c79e9.png)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [5 November 2019 11:55 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/4 "2019-11-05T11:55:48Z")

</div>

Still searching 3 hours later...... 🙂

In the meantime, if I could ask a followup question picking up on "There is no magic to npm modules."

If I install nodes via palette in alternate install, why do they put into ./data/node-modules rather than into ./node-modules like the standard NR install does?

---

<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:** [5 November 2019 12:17 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/5 "2019-11-05T12:17:30Z")

</div>

OK, so it looks like you have some blockly bits left in your global install but not the node.

You have the node installed in your default userDir (`~/.node-red`) so if you are using a globally installed copy of Node-RED, that is fine.

However, if you are using a locally installed version - like my installer creates - you need to also install it in the `data` folder of that installation which is the userDir that you give to the Node-RED instance. Obviously, the easiest way to get that right is to use the palette manager.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [5 November 2019 15:50 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/6 "2019-11-05T15:50:11Z")

</div>

Eureka 🙂

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/cda06447f37b817d40c11857b219cb0cb53a75cb.png)

Deleted that folder, restarted my alternate instance, browser cache empty and its gone 🙂

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1989578ef115ad9c45c03fada023b094bbd64dcc.png)

And my main NR instance is fine

🙂

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 July 2020 11:31 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/7 "2020-07-02T11:31:39Z")

</div>

> [@TotallyInformation](#):
>
> However, if you are using a locally installed version - like my installer creates - you need to also install it in the `data` folder of that installation which is the userDir that you give to the Node-RED instance. Obviously, the easiest way to get that right is to use the palette manager.

Resurrecting this issue with specific example as having testing issues my simpletime node dev

AFAIU a standard node red install sticks all palette contrib nodes into ~/.node-red/node\_modules

Alternate install sticks them into ~/.nrxxxx/data/node-modules

Which is different but works with no problem if just using palette installs

BUT I'd like to test an install from a github dev fork so i use

```auto
npm install --save https://github.com/cymplecy/node-red-contrib-simpletime.git#tickboxes

```

That sticks the github version into ~./nrxxxx/node\_modules

But the alternate install continues to use the original palette version (2.9.1 in this case vs 2.9.6 for my github version)

How can I square this circle so that my github 2.9.6 version overwrites the palette 2.9.1 version?

---

<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:** [2 July 2020 12:17 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/8 "2020-07-02T12:17:05Z")

</div>

If the palette is installing to the "wrong" place, it is because your userDir isn't pointed where you think it is for the running instance. The palette should always be installing to the userDir (as defined in your startup script) and your manual installs should be in the same folder.

Easy enough to check. The package.json file in the userDir will show you whether you have that module installed from GitHub or npm. You could even create a flow to import it and view it. Just note that, if running from the alt. installer, the current working directory in Node-RED will be wherever you installed Node-RED, it won't be the userDir.

Also worth noting that the root folder that the alt. installer uses has it's own package.json file of course since that is where the Node-RED package is installed. You _can_ install Node-RED custom node packages to that folder as well - but then you cannot manage those from the palette and it gets very confusing so best avoided.

One last point - you did restart Node-RED after installing manually? Installing from the palette often gets away without needing to restart but that doesn't work when installing manually.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 July 2020 12:27 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/9 "2020-07-02T12:27:19Z")

</div>

> [@TotallyInformation](#):
>
> If the palette is installing to the "wrong" place, it is because your userDir isn't pointed where you think it is for the running instance.

I'm simply following your instructions when starting 🙂

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/5/e59165b949ed2f4e5b5618f59788c0ca66bd7c2c.png)

---

<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:** [2 July 2020 12:43 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/10 "2020-07-02T12:43:18Z")

</div>

Yep, so that will make the userDir `./data` and the palette will install to that folder.

The start script should be:

```auto
node node_modules/node-red/red.js --userDir ./data

```

But in the package.json for the data folder, start should be:

```auto
cd .. && node node_modules/node-red/red.js --userDir ./data

```

or alternatively:

```auto
node ../node_modules/node-red/red.js --userDir ../data

```

I think, I've not actually tried that one - you could make everything absolute references of course and then you might save some confusion. Though it wouldn't then work without tweaking if you ever move it. The advantage of the settings is that they don't need to take account of the location of the parent folder. and even if you rename that folder or copy it somewhere, everything still works as expected.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 July 2020 12:57 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/11 "2020-07-02T12:57:02Z")

</div>

> [@TotallyInformation](#):
>
> Yep, so that will make the userDir `./data` and the palette will install to that folder.

All agreed with that - that's what happens 🙂

I think my question is - how do I make my github installs overwrite that one rather than get put into ~.nrxxxx/node\_modules?

---

<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:** [2 July 2020 13:05 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/12 "2020-07-02T13:05:36Z")

</div>

```auto
cd ~/.nrxxxx
npm install --save https://github.com/cymplecy/node-red-contrib-simpletime.git#tickboxes

```

I keep everything on my dev PC under the `c:\src` folder:

```auto
cd c:\src\nr2
# This is where node-red was installed
cd data
# This is the userDir
npm install --save https://github.com/cymplecy/node-red-contrib-simpletime.git#tickboxes

```

On my home server everything is under my normal login and Node-RED lives in `~\nrlive`, it looks like this:

```auto
cd ~\nrlive
# This is where node-red was installed
cd data
# This is the userDir
npm install --save https://github.com/cymplecy/node-red-contrib-simpletime.git#tickboxes

```

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 July 2020 13:11 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/13 "2020-07-02T13:11:06Z")

</div>

> [@TotallyInformation](#):
>
> ```auto
> cd ~/.nrxxxx
> npm install --save https://github.com/cymplecy/node-red-contrib-simpletime.git#tickboxes
> 
> ```

This is back to square one 🙂

That's what I'm doing  
[edit about 5 times now !] I'm in /home/pi/.nr18884\_simpletime folder in this instance when I issue this command[/edit]

> [@cymplecy](#):
>
> BUT I'd like to test an install from a github dev fork so i use
> 
> ```auto
> npm install --save https://github.com/cymplecy/node-red-contrib-simpletime.git#tickboxes
> 
> ```
> 
> That sticks the github version into ~./nrxxxx/node\_modules

---

<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:** [2 July 2020 13:26 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/14 "2020-07-02T13:26:56Z")

</div>

Is `/home/pi/.nr18884_simpletime` where you have Node-RED installed or is it the userDir you are using?

If the latter, that is exactly where you should be and you will end up with a folder `/home/pi/.nr18884_simpletime/node_modules/node-red-contrib-simpletime/` and an entry in `/home/pi/.nr18884_simpletime/package.json` showing simpletime is a dependency and is using the GitHub version.

Manage Palette will show the node and whatever version number is in the package.json of the installed version as in this example of the dev version of uibuilder:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/9/895ce913f7a4142b5e0002e3575049b809116b29.png)

It doesn't show that it comes from GitHub.

By the way, when installing from GitHub, you can simply do:

```auto
npm install cymplecy/node-red-contrib-simpletime#tickboxes

```

npm is already GitHub aware & --save is the default anyway.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 July 2020 13:34 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/15 "2020-07-02T13:34:00Z")

</div>

There seems to be total confusion between us as to what is going on 🙂

I'm going to start again and record a video of each step to show what happens with me

Hopefully, that will either show you my issue or show me what I'm doing wrong 🙂

PS - I'm off to dig some holes in the garden for trees and hedge as a displacement activity 🙂

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 July 2020 15:19 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/17 "2020-07-02T15:19:26Z")

</div>

Bangs head against wall 😆

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 July 2020 17:07 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/18 "2020-07-02T17:07:43Z")

</div>

OK - I've given up trying to document what is going on as my recorded gif is unreadable!

I turned to googling and came up with the npm --prefix flag

so in my new test /home/pi/nrtest folder (having previously installed simple time using palette and got 2.9.1) I did this

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/efee31389ae4809d653c02e21f46af7e7fcf253c.png)

and it updated the existing /home/pi/nrtest/data/node\_modules/node-red-contrib-simpletime files to v2.9.6 and updated what it thinks it is installed in the palette

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/faceebf916b226fda4bf1ba49f3da4cbaec65dee.png)

---

<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:** [2 July 2020 19:33 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/19 "2020-07-02T19:33:11Z")

</div>

Genuinely, I'm at a loss as to what is happening for you.

The alt. installer actually works in a more node.js/npm way than Node-RED's "recommended" installation and I've never had any issues with it. Though admittedly I always keep the userDir inside the main Node-RED dir since that can then all be moved/copied together.

`--prefix` is meant to be used if you want to install something to a folder other than the folder you are currently in.

From your command image. It looks to me as though you are in the folder where you installed Node-RED itself but you are trying to install the module to the data subfolder. Not sure why you haven't just cd'd to the subfolder and done a normal install from there?

Assuming you are starting node-red from the `~/nrtest` folder with `node node_modules/node-red/red.js --userDir ./data` then everything would be in the right place anyway.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 July 2020 20:18 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/20 "2020-07-02T20:18:01Z")

</div>

AFAICT this is just a communication breakdown between us.

The main issue is that you speak npm fluently and I only know 3 words 🙂

I think it needs somebody else to bring us together round the table 🙂

Anyway - I currently have got both palette installs and npm github installs going into the same folder - so at least I can use it for testing which is my goal 🙂

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [3 July 2020 12:08 UTC](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507/21 "2020-07-03T12:08:41Z")

</div>

Apologies - having had a sleep and doing a clean install routine a few times I find I don't need the --prefix if I cd into the data folder e.g ~/nrtest/data before doing the npm install.

It does overwrite the previous contrib node install that was installed using palette.

(As previous found out - it doesn't work if I issue the npm install from the basefolder e.g ~/nrtest)

So I'm sorted - apologies again

[Next page](https://discourse.nodered.org/t/sort-out-node-installed-globally/17507.md?page=2)
