Installing Node-red on Linux server

Hi All,

I am trying to install Node-red on Linux machine under specific user and inside some folder. But by default node-red is getting installed under user home directory. Is there a way to give path while installing node-red modules?

Below are the steps followed to install Node-red Module.

Step 1 : Log in to Linux machine as user(not root user)
Step 2: Install node JS under some specific folder(ex: /opt/nodejs)
Step 3 : install node-red using below command
npm install -g --unsafe-perm node-red

Above step install node-red under user home directory. For example, suppose if I have logged in as ankuser then .nodered folder gets created under /home/ankuser/.nodered.
But in my case i want to install node-red under "/opt/nodered" path.
How can i do this? can any one suggest me the command to be used to install the same.

Thanks and Regards,

Hi @Ankitha
you are mixing up where node-red is installed and where it stores user data.

Installing node-red with npm install -g --unsafe-perm node-red will have installed it somewhere under /usr/lib (or maybe /usr/local/lib).

When you run Node-RED it, by default, uses ~/.node-red as the user directory to store flow configuration etc. You can override the directory it uses for this using the --userDir argument to the node-red command. See https://nodered.org/docs/getting-started/running for details.

1 Like

Hi Knolleary,

Thanks a lot for clarifying.
Now I am able to install and start node-red by specifying --userDir.
Is it possible to install node-red without "npm install" command. If there is no internet to download node-red modules and install, in this case how can we install node-red? I mean through binaries is it possible to install?

Can you please help me on this.
Thanks in advance.

Thanks and Regards,

Have you tried the method described here? https://stackoverflow.com/questions/23250805/how-to-install-nodejs-project-locally-without-internet-connection

The first google result for "https://www.google.com/search?client=safari&rls=en&q=how+to+npm+install+without+internet&ie=UTF-8&oe=UTF-8"

Hi Ukmoose,

Thanks for link. Yes I have tried above steps given in given link but I am getting errors while executing "npm install" command as it is unable to install all the node modules.

I could see below error.

/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/cxxabi-forced.h:29: error: expected declaration before end of line
make: *** [Release/obj.target/fibers/src/fibers.o] Error 1
make: Leaving directory /opt/hpe/sis/nodered/node-red-0.19.5/node_modules/fibers/build' gyp ERR! build error gyp ERR! stack Error:makefailed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/opt/hpe/sis/nodejs/node-v8.12.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23) gyp ERR! stack at emitTwo (events.js:126:13) gyp ERR! stack at ChildProcess.emit (events.js:214:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) gyp ERR! System Linux 2.6.32-573.el6.x86_64 gyp ERR! command "/opt/hpe/sis/nodejs/node-v8.12.0-linux-x64/bin/node" "/opt/hpe/sis/nodejs/node-v8.12.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release" gyp ERR! cwd /opt/hpe/sis/nodered/node-red-0.19.5/node_modules/fibers gyp ERR! node -v v8.12.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok node-gyp exited with code: 1 Please make sure you are using a supported platform and node version. If you would like to compile fibers on this machine please make sure you have setup your build environment-- Windows + OS X instructions here: https://github.com/nodejs/node-gyp Ubuntu users please run:sudo apt-get install g++ build-essential**RHEL users please run:yum install gcc-c++andyum groupinstall 'Development Tools'** Alpine users please run:sudo apk add python make g++`
sh: nodejs: command not found
npm WARN node-red-node-test-helper@0.1.7 requires a peer of node-red@~0.18.4 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Installed yum install gcc-c++andyum groupinstall 'Development Tools as recommended but no luck.

Thanks and Regards,