Installing node-red on Synology NAS

Hi there.
I won't there are tons of resources on the internet on how to install node-red on a Synology NAS without Docker. But I'm still strugling.

I've alredy enabled user home under user-advanced
I've installed node.js package from the Package center (I installed all the versions since I was desperate)
When running the command from SSH the installation throws errors. Node-red isn't installed.
Here are the errors:

sudo npm install -g --unsafe-perm node-red
Password:
/volume2/@appstore/Node.js_v8/usr/local/bin/node-red-pi -> /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/bin/node-red-pi
/volume2/@appstore/Node.js_v8/usr/local/bin/node-red -> /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/red.js

> bcrypt@3.0.6 install /volume2/@appstore/Node.js_v8/usr/local/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 Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v57-linux-arm-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@8.9.4 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 3.2.40
gyp ERR! command "/volume2/@appstore/Node.js_v8/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding" "--napi_version=1" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/volume2/@appstore/Node.js_v8/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=1 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 3.2.40
node-pre-gyp ERR! command "/volume2/@appstore/Node.js_v8/usr/local/bin/node" "/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v8.9.4
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/volume2/@appstore/Node.js_v8/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=1 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 (node_modules/node-red/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ node-red@0.20.7
updated 1 package in 556.392s

Note that at the end it says updated 1 package because this was the second time trying to install it

The reason you won't find many resources is because you will need to install various packages with a package manager that is not available. So you will first need to install the package manager (opkg, entware), then install a compiler and very much depending on your CPU it will either build or not.

Your solution: install docker and run it in docker.

I thought it was much easier. At least this tutorial seemed like it: https://www.rs-online.com/designspark/installing-node-red-on-a-synology-nas

I will try to install docker but my NAS is not suported...

You could try to install the bcrypt binary directly
npm install -g --save bcrypt-nodejs

Retry installing node-red after that

2 Likes

Still no luck. And I have found out that Docker is not compatible with my NAS

admin@server:~$ sudo npm install -g --save bcrypt-nodejs
Password:
npm WARN deprecated bcrypt-nodejs@0.0.3: bcrypt-nodejs is no longer actively maintained. Please use bcrypt or bcryptjs. See https://github.com/kelektiv/node.bcrypt.js/wiki/bcrypt-vs-brypt.js to learn more about these two options
+ bcrypt-nodejs@0.0.3
added 1 package in 6.675s
admin@server:~$ sudo npm install -g --unsafe-perm node-red
/volume2/@appstore/Node.js_v8/usr/local/bin/node-red -> /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/red.js
/volume2/@appstore/Node.js_v8/usr/local/bin/node-red-pi -> /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/bin/node-red-pi

> bcrypt@3.0.6 install /volume2/@appstore/Node.js_v8/usr/local/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 Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt_lib-v3.0.6-node-v57-linux-arm-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@8.9.4 (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack     at getNotFoundError (/usr/local/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 3.2.40
gyp ERR! command "/volume2/@appstore/Node.js_v8/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding" "--napi_version=1" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/volume2/@appstore/Node.js_v8/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=1 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 3.2.40
node-pre-gyp ERR! command "/volume2/@appstore/Node.js_v8/usr/local/bin/node" "/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v8.9.4
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/volume2/@appstore/Node.js_v8/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/volume2/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding --napi_version=1 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 (node_modules/node-red/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ node-red@0.20.7
updated 2 packages in 240.386s

@mbc99 despite all the errors, that is actually a successful install of Node-RED.

The key thing to spot is that all of the errors are followed by the line:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 (node_modules/node-red/node_modules/bcrypt):

The bcrypt module is the only one we have that contains native code that needs building. On some platforms that can cause issues - such as you are seeing.

For this reason, it is marked as an optional dependency as we can tolerate it not installing. We can do that because we also depend on bcryptjs which is a pure javascript implementation of the same functionality - albeit much slower.

1 Like

So you are saying that node-red should work anyway. However if I try to launch node-red (by simply typing node-red) I get and error: command not found

That's probably a separate issue of whether your PATH is properly setup to include things installed as npm modules.

1 Like

Ok. So then I should first search where node-red was really installed to be able to run it from that path right?

I clearly need to read, this part (bcrypt) gave me a lot of headaches trying to install on a syno before.

1 Like

Hi folks,

I've ended up on this thread a few times while working with my node red installation. I thought I would post some things that helped me.

First of all, this thread is very helpful : https://www.rs-online.com/designspark/installing-node-red-on-a-synology-nas

However, for some reason I have different paths to this guy - perhaps because of the account I was logged in to?

First point is that I received errors during the install process, but it all works fine, so don't assume it's not working..

To get it to run so that the process is persistent, you need to run it using pm2 - and, in my case, I need to use explicit paths as follows:

/volume1/@appstore/Node.js_v8/usr/local/bin/pm2 start /volume1/@appstore/Node.js_v8/usr/local/bin/node-red -- -v

(there is no newline character in the above btw).

To get the process to run automatically on boot is not as straight forward as it should be and the guy in the post above doesn't explain the script. First of all, you need to run the script as the user you installed it with and there is a bug in Synology DSM when you try to run a script as a user which isn't the root - see here: http://www.damirscorner.com/blog/posts/20190301-SchedulingATaskOnASynologyNas.html

The script I use to run on boot is as follows:


#!/bin/bash
export USER=[my username]
export HOME="/var/services/homes/[my username]"
cd $HOME
/volume1/@appstore/Node.js_v8/usr/local/bin/pm2 start /volume1/@appstore/Node.js_v8/usr/local/bin/node-red -- -v

The bug linked to above means that scripts run as non-root users will still have the home directory as /root and the $USER is root. The first three lines take care of this by setting the appropriate environment variables and then changing directory to your home directory.

You need to replace [my username] with your username.

Hope this helps someone.

I also have a working node RED on a Synology DS214e (also no docker support). Indeed lots of bcrypt-nodejs warnings, but everything looks fine.
I can start it via this path (from my documentation):
me @ syno: /volume1/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/bin$ ./node-red-pi
13 Sep 21:24:54 - [info]

Welcome to Node-RED

13 Sep 21:24:54 - [info] Node-RED version: v0.20.8
13 Sep 21:24:54 - [info] Node.js version: v8.9.4
13 Sep 21:24:54 - [info] Linux 3.2.40 arm LE
13 Sep 21:25:03 - [info] Loading palette nodes

Kind regards,

1 Like

Had the same problem as mbc99 when installing as admin user. Changed to default user and reinstalled with less errors.

The command node-red also did not work. I managed to start it with:

/volume1/@appstore/Node.js_v8/usr/local/lib/node_modules/node-red/red.js

Hello, if you are looking for an easier way to install Node-Red on a Synology NAS & Docker, there is this website that contains step-by-step instructions on how to do it. You can take a look:

https://www.atomicha.com/synology-nas-docker-installing-node-red-part-1-node-red-requirements/