diff --git a/src/freedombone-app-peertube b/src/freedombone-app-peertube
index 169b140a195218718db9278a09430444660a4a85..b7913bae1ad3ce38e3d5b7f582ae71fa683e250b 100755
--- a/src/freedombone-app-peertube
+++ b/src/freedombone-app-peertube
@@ -653,7 +653,7 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/source
 apt-get -y update
 apt-get -yq install yarn
 
-#npm install --arch=$NPM_ARCH -g yarn
+#npm install --arch=$NPM_ARCH -g yarn@1.5.1
 #if [ ! "\$?" = "0" ]; then
 #    echo $'PeerTube Failed to install yarn'
 #    exit 79353234
@@ -675,11 +675,22 @@ if [ ! "\$?" = "0" ]; then
     echo $'PeerTube failed to run yarn install'
     exit 63754235
 fi
+if ! npm install --arch=$NPM_ARCH -g npm@4; then
+    # https://github.com/KraigM/homebridge-harmonyhub/issues/119
+    echo $'Failed to downgrade npm'
+    exit 3476835
+fi
+cp /root/.npm-global/bin/npm /usr/local/bin/npm
 npm install --arch=$NPM_ARCH
 if [ ! "\$?" = "0" ]; then
     echo $'PeerTube failed to install peertube'
     exit 7835243
 fi
+if ! npm install --arch=$NPM_ARCH -g "npm@${NPM_VERSION}"; then
+    echo $'Failed to restore npm after downgrade'
+    exit 5737583
+fi
+cp /root/.npm-global/bin/npm /usr/local/bin/npm
 npm run build --arch=$NPM_ARCH
 if [ ! "\$?" = "0" ]; then
     echo $'PeerTube failed to build peertube'