diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise
index de95e087c698251d202fa23a62130356e383a5ba..42114ee3ef8b57ca110d9864033583fe929e6f42 100755
--- a/src/freedombone-image-customise
+++ b/src/freedombone-image-customise
@@ -562,13 +562,7 @@ INSTALL_DIR=$HOME/build
 INSTALLING_MESH=
 
 install_patchwork() {
-    NPM_ARCH='ia32'
-    if [[ $ARCHITECTURE == 'arm'* ]]; then
-        NPM_ARCH='armv7l'
-    fi
-    if [[ $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'amd64' ]]; then
-        NPM_ARCH='x64'
-    fi
+    get_npm_arch
 
     git clone https://github.com/ssbc/patchwork $rootdir/etc/patchwork
 
diff --git a/src/freedombone-utils-nodejs b/src/freedombone-utils-nodejs
index 4fdb4a4c6f10bf6b6ed43dcfbd2e045d1c2a2849..ed680ed6b4f513b65ae4fe63cb6ad803aa5f9200 100755
--- a/src/freedombone-utils-nodejs
+++ b/src/freedombone-utils-nodejs
@@ -43,6 +43,16 @@ NPM_VERSION='4.0.5'
 # so that it can be removed if tere are no apps which need it
 NODEJS_INSTALLED_APPS_FILE=$HOME/.nodejs-apps
 
+function get_npm_arch {
+    NPM_ARCH='ia32'
+    if [[ $ARCHITECTURE == 'arm'* ]]; then
+        NPM_ARCH='armv7l'
+    fi
+    if [[ $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'amd64' ]]; then
+        NPM_ARCH='x64'
+    fi
+}
+
 function mesh_install_nodejs {
     chroot "$rootdir" apt-get -yq install g++ m4 libtool automake nodejs curl
     chroot "$rootdir" apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
@@ -73,6 +83,14 @@ function mesh_install_nodejs {
         sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
         chroot "$rootdir" /root/npm_install.sh
     fi
+    if [ ! -f $rootdir/usr/bin/npm ]; then
+        echo $'npm was not installed'
+        exit 5290462
+    fi
+
+    # update from the old debian nodejs version
+    get_npm_arch
+    chroot "$rootdir" npm install --arch=$NPM_ARCH node@$NODEJS_VERSION -g
 }
 
 function remove_nodejs {