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.
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.
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 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.
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]
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: