Update NodeJS on Qnap and fix insufficient space issue

Rss feed for topic ArticleArticle - Posted by: christian On 07-01-2016 @ 00:12 - Updated on: 07-01-2016 @ 00:12

This week I needed Nodejs and NPM on my qnap to run Nefit easy http server to have an bridge between my nefit easy thermostate and my fibaro home center 2(Maybe I will write an article on this later). Fairly quickly I found out the nodejs version that can be installed from the qnap app center is old and not sufficient to run the applications. So I tried to update it to the newest version and fix the problem where my ramdisk was out of space when I tried to install any npm package.

To start install the nodejs package from the app center(the nodejs version isn't needed but this is much easier as you don't need to create any startup script or whatever since you can just use the default one).

Update to newest version

After this, login to your nas through SSH(use putty for this for example). Go into your nodejs directory. For me it was located at "/share/MD0_DATA/.qpkg/nodejs". Rename the "node" directory to "node-old" with the following command: mv node node-old

Download the newest nodejs version to your nas using wget. This can be done with the following command:


The newest version can be found here you need the "Linux binaries" 32 bit version

Run to extract: tar zxf ./node-v4.3.4-linux-x86.tar.gz
Rename the directory: mv node-v4.3.4-linux-x86 node

After this you can just update with: npm install npm -g

Fix insufficient space issue on qnap ramdisk when installing a npm package

The problem is, the default location of the npm cache is in root(/root/.npm to be more preciselly) which is on the qnap ramdisk. This location is quite small, around 140mb on my NAS(on some other types even smaller). So we can simply fix this by changing the location of this directory to a path located on the harddrive instead of the ramdisk.

Just run the following command:

npm config set cache /share/MD0_DATA/.qpkg/nodejs/.npm --global

To check if the change has been applied correctly run: npm config list

Hint: incase you already have a qnap where the ramdisk is 100% in use because of this issue simply restar the qnap and the problem will be fixed.