Skip to content

Instantly share code, notes, and snippets.

@dalekunce
Created January 18, 2015 13:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dalekunce/6de907ff8386a848a8f4 to your computer and use it in GitHub Desktop.
Save dalekunce/6de907ff8386a848a8f4 to your computer and use it in GitHub Desktop.
Install nodejs on synology box

NodeJS Synology Install Guide

Lots of time was saved by finding this guide, partially repeated below. http://forum.synology.com/enu/viewtopic.php?f=40&t=84073#p317463

###login

ssh root@ipforsynologybox

###create the optware root directory enter the following commands:

mkdir /volume1/@optware
mkdir /opt
mount -o bind /volume1/@optware /opt

###set up IPKG enter the following commands

feed=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable
ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'`
wget $feed/$ipk_name
tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf -
mkdir -p /opt/etc/ipkg
echo "src cross $feed" > /opt/etc/ipkg/feeds.conf

###Fix some PATH issues

vi /etc/profile

Add the following line to /etc/profile:

PATH=/opt/bin:/opt/sbin:$PATH
vi /root/.profile

Add the following line to /root/.profile:

PATH=/opt/bin:/opt/sbin:$PATH

###Reboot Reboot your DiskStation. Do NOT use the "reboot" command, use "reboot -f" or reboot with the DSM GUI.

reboot -f

###Create some local optware stuff Create the /etc/rc.local file and insert:

vi /etc/rc.local
#!/bin/sh

# Optware setup
[ -x /etc/rc.optware ] && /etc/rc.optware start

exit 0

Make it executable

chmod 755 /etc/rc.local

Create the /etc/rc.optware

vi /etc/rc.optware

Insert

#! /bin/sh

if test -z "${REAL_OPT_DIR}"; then
# next line to be replaced according to OPTWARE_TARGET
REAL_OPT_DIR=/volume1/@optware
fi

case "$1" in
   start)
      echo "Starting Optware."
      if test -n "${REAL_OPT_DIR}"; then
         if ! grep ' /opt ' /proc/mounts >/dev/null 2>&1 ; then
            mkdir -p /opt
            mount -o bind ${REAL_OPT_DIR} /opt
         fi
      fi
   [ -x /opt/etc/rc.optware ] && /opt/etc/rc.optware
   ;;
   reconfig)
   true
   ;;
   stop)
      echo "Shutting down Optware."
   true
   ;;
   *)
      echo "Usage: $0 {start|stop|reconfig}"
      exit 1
esac

exit 0

Make it executable

chmod 755 /etc/rc.optware

Update and upgrade ipkg

ipkg update
ipkg ugrade

###Install Git and Node

ipkg install git
cd /root
git clone https://github.com/joyent/node.git
cd node
./configure --prefix=/opt/node
make
make install

If you get a C compiler issue when trying to ./configure fix the c compiler symlink

ln -s /opt/bin/gcc /opt/bin/cc

Try ./configure again

If you get an error talking about GYP

gyp:name 'arm_version' is not defined while evaluating condition 'arm_version==7' in /home/ubuntu/node/deps/v8/tools/gyp/v8.gyp while loading dependencies of /home/ubuntu/node/node.gyp while trying to load /home/ubuntu/node/node.gyp
Error running GYP

Add the following to 'variables' in common.gypi:

'arm_version%' : '1', so it looks like this:

{
  'variables': {
  'werror': '',                    # Turn off -Werror in V8 build.
  'visibility%': 'hidden',         # V8's visibility setting
  'target_arch%': 'ia32',          # set v8's target architecture
  'host_arch%': 'ia32',            # set v8's host architecture
  'want_separate_host_toolset': 0, # V8 should not build target and host
  'library%': 'static_library',    # allow override to 'shared_library' for D$
  'component%': 'static_library',  # NB. these names match with what V8 expec$
  'msvs_multi_core_compile': '0',  # we do enable multicore compiles, but not$
  'gcc_version%': 'unknown',
  'clang%': 0,
  'python%': 'python',
  'arm_version%' : '1',

# Enable V8's post-mortem debugging only on unix flavors.

./configure should work now

make
make install

###All Done

@CesMak
Copy link

CesMak commented Apr 10, 2017

Hey there,
this is kind of the only instruction I found on how to install node js on a synology nas....
Here is what I would like to do: I have a simple website written so far which means I have a .css a .html and a .js file all in a folder on my nas and through my router and free dyndns I created a nice website which works fine for me. Now I want to upgrade it with node js so that it is possible for me to upload data to the server and do ther node.js stuff....

So far, I just installed node js over my package center with my disk station but now I dont have a clue what to do next.
Just follow this tutorial?

@bog7
Copy link

bog7 commented Apr 12, 2020

Greetings,
I appreciate this guide but there is an issue with the Synology Diskstation D210+, described in this post:
https://community.synology.com/enu/forum/17/post/50346

Whenever I run ipkg, I get this error:
/opt/bin/ipkg: line1: syntax error: unexpected word (expecting ")")

Supposedly the solution was to use binaries location in /usr/syno/bin/ instead of /opt/bin/

This is far beyond my skill level. I would appreciate it if you could help with alternate instructions using this fix for the DS210+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment