瀏覽代碼

Try building peertube locally with a recent node version

Bob Mottram 7 年之前
父節點
當前提交
12b95f0e76
共有 1 個檔案被更改,包括 31 行新增13 行删除
  1. 31
    13
      src/freedombone-app-peertube

+ 31
- 13
src/freedombone-app-peertube 查看文件

200
     function_check set_repo_commit
200
     function_check set_repo_commit
201
     set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO
201
     set_repo_commit $PEERTUBE_DIR "peertube commit" "$PEERTUBE_COMMIT" $PEERTUBE_REPO
202
 
202
 
203
-    npm run upgrade-peertube
203
+    alias npm-exec='PATH=$(npm bin):$PATH'
204
+    npm-exec npm run upgrade-peertube
205
+
204
     chown -R peertube:peertube $PEERTUBE_DIR
206
     chown -R peertube:peertube $PEERTUBE_DIR
205
     systemctl start peertube
207
     systemctl start peertube
206
 }
208
 }
770
     git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT
772
     git checkout $PEERTUBE_COMMIT -b $PEERTUBE_COMMIT
771
     set_completion_param "peertube commit" "$PEERTUBE_COMMIT"
773
     set_completion_param "peertube commit" "$PEERTUBE_COMMIT"
772
 
774
 
773
-    npm install -g yarn
775
+    npm install npm@5.6.0
774
     if [ ! "$?" = "0" ]; then
776
     if [ ! "$?" = "0" ]; then
775
-        echo $'Failed to install yarn'
776
-        exit 79353234
777
+        echo $'Failed to install local npm version 5.6.0'
778
+        exit 45465774
779
+    fi
780
+    alias npm-exec='PATH=$(npm bin):$PATH'
781
+    npm-exec install node@9.5.0
782
+    if [ ! "$?" = "0" ]; then
783
+        echo $'Failed to install local nodejs version 9.5.0'
784
+        exit 54875459
777
     fi
785
     fi
778
-    yarn add -D webpack --network-concurrency 1
779
-    yarn install
786
+    npm install npm@5.6.0
780
     if [ ! "$?" = "0" ]; then
787
     if [ ! "$?" = "0" ]; then
781
-        echo $'Failed to run yarn install'
782
-        exit 63754235
788
+        echo $'Failed to install local npm version 5.6.0'
789
+        exit 678356845684
783
     fi
790
     fi
784
-    npm install
791
+    npm install yarn@1.3.2
792
+    if [ ! "$?" = "0" ]; then
793
+        echo $'Failed to install yarn'
794
+        exit 578947946
795
+    fi
796
+    npm-exec yarn add -D webpack --network-concurrency 1
797
+    #npm-exec yarn install --non-interactive
798
+    #if [ ! "$?" = "0" ]; then
799
+    #    echo $'Failed to run yarn install'
800
+    #    exit 63754235
801
+    #fi
802
+    npm-exec npm install
785
     if [ ! "$?" = "0" ]; then
803
     if [ ! "$?" = "0" ]; then
786
         echo $'Failed to install peertube'
804
         echo $'Failed to install peertube'
787
         exit 7835243
805
         exit 7835243
788
     fi
806
     fi
789
-    npm run build
807
+    npm-exec npm run build
790
     if [ ! "$?" = "0" ]; then
808
     if [ ! "$?" = "0" ]; then
791
         echo $'Failed to build peertube'
809
         echo $'Failed to build peertube'
792
         exit 5293593
810
         exit 5293593
803
     echo 'User=peertube' >> /etc/systemd/system/peertube.service
821
     echo 'User=peertube' >> /etc/systemd/system/peertube.service
804
     echo 'Group=peertube' >> /etc/systemd/system/peertube.service
822
     echo 'Group=peertube' >> /etc/systemd/system/peertube.service
805
     echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service
823
     echo "WorkingDirectory=$PEERTUBE_DIR" >> /etc/systemd/system/peertube.service
806
-    echo "ExecStart=/usr/local/bin/npm start" >> /etc/systemd/system/peertube.service
807
-    echo "ExecStop=/usr/local/bin/npm stop" >> /etc/systemd/system/peertube.service
824
+    echo "ExecStart=$PEERTUBE_DIR/node_modules/.bin/npm start" >> /etc/systemd/system/peertube.service
825
+    echo "ExecStop=$PEERTUBE_DIR/node_modules/.bin/npm stop" >> /etc/systemd/system/peertube.service
808
     echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service
826
     echo 'StandardOutput=syslog' >> /etc/systemd/system/peertube.service
809
     echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service
827
     echo 'StandardError=syslog' >> /etc/systemd/system/peertube.service
810
     echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service
828
     echo 'SyslogIdentifier=peertube' >> /etc/systemd/system/peertube.service
811
     echo 'Restart=always' >> /etc/systemd/system/peertube.service
829
     echo 'Restart=always' >> /etc/systemd/system/peertube.service
812
-    echo "Environment=NODE_ENV=production" >> /etc/systemd/system/peertube.service
830
+    echo "Environment=NODE_ENV=production PATH=\$(npm bin):\$PATH" >> /etc/systemd/system/peertube.service
813
     echo '' >> /etc/systemd/system/peertube.service
831
     echo '' >> /etc/systemd/system/peertube.service
814
     echo '[Install]' >> /etc/systemd/system/peertube.service
832
     echo '[Install]' >> /etc/systemd/system/peertube.service
815
     echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service
833
     echo 'WantedBy=multi-user.target' >> /etc/systemd/system/peertube.service