# Instructions to deploy on Azure/Ubuntu LTS 18.04 fail

**URL:** <https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070>\
**Category:** General\
**Created:** [4 May 2020 14:19 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070 "2020-05-04T14:19:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eelco](https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/32.png) [@Eelco](https://discourse.nodered.org/u/Eelco)\
**Post date:** [4 May 2020 14:19 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070/1 "2020-05-04T14:19:02Z")

</div>

I did create new VM today on Azure and tried to deploy NodeRed per [Running on Microsoft Azure : Node-RED](https://nodered.org/docs/getting-started/azure)  
The process broke on installation of node red with error in bcrypt.

I did use work-around to install unsafe, i.e. replace "sudo npm install -g node-red" with "sudo npm install -g --unsafe-perm node-red"

Question 1: can I recover from "unsafe" to safe somehow. What risks have I introduced to my installation?

Question 2: can someone review Azure installation instructions to make them "work out of the box"?

> Relevant section from log
> 
> > bcrypt@3.0.6 install /usr/lib/node\_modules/node-red/node\_modules/bcrypt  
> > node-pre-gyp install --fallback-to-build
> 
> node-pre-gyp WARN Using request for node-pre-gyp https download
> 
> node-pre-gyp WARN Pre-built binaries not installable for bcrypt@3.0.6 and node@10.20.1 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
> 
> node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/lib/node\_modules/node-red/node\_modules/bcrypt/lib'
> 
> Killed
> 
> pilot@bagxml-U18:~$ gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/home/pilot/.cache/node-gyp/10.20.1"

---

<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:** [4 May 2020 18:29 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070/2 "2020-05-04T18:29:06Z")

</div>

What command did you type exactly to install it ?

---

<div class="post-metadata">

**Author:** ![Eelco](https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/32.png) [@Eelco](https://discourse.nodered.org/u/Eelco)\
**Post date:** [8 May 2020 23:00 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070/3 "2020-05-08T23:00:40Z")

</div>

First attempt: sudo npm install -g node-red  
This one failed as illustrated in quote from log

Second attempt from Raspberry/Mac instructions: sudo npm install -g --unsafe-perm node-red  
This one was successful

I try to understand impact of --unsafe-perm flag

Explanation on [stackabuse.com](http://stackabuse.com) (ultimate guide to configuring mom) does not speak to me. What is the impact of surpressing a switch in userID?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 May 2020 23:41 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070/4 "2020-05-08T23:41:12Z")

</div>

> [@Eelco](#):
>
> Second attempt from Raspberry/Mac instructions: sudo npm install -g --unsafe-perm node-red  
> This one was successful

You realise this is written in the [official docs](https://nodered.org/docs/getting-started/local)?

And also there is a script to further simplify installation on [rpi & Ubuntu](https://nodered.org/docs/getting-started/raspberrypi)

---

<div class="post-metadata">

**Author:** ![Eelco](https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/32.png) [@Eelco](https://discourse.nodered.org/u/Eelco)\
**Post date:** [9 May 2020 08:09 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070/5 "2020-05-09T08:09:56Z")

</div>

Hi Steve,  
I am not a CLI hero so, yes, I rely a lot on documentation.  
This time I am setting up an Azure instance with more attention to security than my usual RPI or "ubunto on old laptop" deployment.

The instructions in official doc for setting up on Azure failed on me.

That is why I opened this post, to understand security implementation of "--unsafe-perm"' (and to let someone with deep understanding look at Azure set-up instructions).

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 May 2020 08:14 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070/6 "2020-05-09T08:14:14Z")

</div>

From [here](https://geedew.com/What-does-unsafe-perm-in-npm-actually-do/)

> I suppose that this isn’t ‘unsafe’ but it does force the package installer to never drop into user and group switching when installing apps. It’s possible then you may end up having the code run as ‘root’ when installing (which could then be considered ‘unsafe’);

So basically DONT run node-red as admin/sudo (which I am certain the docs say AND the installer script sorts out when it creates the service)

Regarding the docs - I guess you are asking if the docs should be updated...  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bdca8ffafd2f5e77365b8bcb90af48b005a89dc1.png)  
...to say `sudo npm install -g --unsafe-perm node-red`

I dont know the answer to that but it would seem to be "Yes, docs need updating" based on what you posted.

Hopefully Dave or Nick can clarify.

---

<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:** [9 May 2020 11:33 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070/7 "2020-05-09T11:33:47Z")

</div>

As the quote you added indicates (sort of) - by default npm tries to be a good citizen - so when it is run as root... if it then calls out to other programs (like in our case node-gyp) in order to compile native code (we optionally want bcrypt) - then it drops all execution privileges just in case the 3rd party app wants to do something bad. If run as a non root user (without sudo) - it doesn't do this. So yes when we install as root then yes we do need the --unsafe-perm flag , which then stops it dropping privileges. I'll fix the docs.

---

<div class="post-metadata">

**Author:** ![Eelco](https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/32.png) [@Eelco](https://discourse.nodered.org/u/Eelco)\
**Post date:** [9 May 2020 22:45 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070/8 "2020-05-09T22:45:33Z")

</div>

Thank you both for responses.  
My understanding

- npm install in default mode runs script under local permissions. Sometimes this gives a conflict of insufficient rights
- npm install under sudo runs under root permission with risk to launch a script that can do damage
- npm install --unsafe-perm runs all script under permissions of user

I have no clue why default way of working favours local permissions, but to run everything as "myself" does not feel as extraordinary risky.

Case closed 😊

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 July 2020 22:54 UTC](https://discourse.nodered.org/t/instructions-to-deploy-on-azure-ubuntu-lts-18-04-fail/26070/9 "2020-07-08T22:54:34Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
