瀏覽代碼

Installing npm on mesh image

Bob Mottram 7 年之前
父節點
當前提交
d0eb13b5ec
共有 1 個檔案被更改,包括 10 行新增12 行删除
  1. 10
    12
      src/freedombone-utils-nodejs

+ 10
- 12
src/freedombone-utils-nodejs 查看文件

74
         exit 7235728
74
         exit 7235728
75
     fi
75
     fi
76
 
76
 
77
-    if [ -f /usr/share/npm/bin/npm-cli.js ]; then
78
-        ln -s /usr/share/npm/bin/npm-cli.js /usr/bin/npm
79
-    else
80
-        wget https://www.npmjs.com/install.sh -O $rootdir/root/npm_install.sh
81
-        if [ ! -f $rootdir/root/npm_install.sh ]; then
82
-            echo $'Unable to download npm installer'
83
-            exit 8793636
84
-        fi
85
-        chroot "$rootdir" chmod +x /root/npm_install.sh
86
-        sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
87
-        chroot "$rootdir" /root/npm_install.sh
77
+    wget https://www.npmjs.com/install.sh -O $rootdir/root/npm_install.sh
78
+    if [ ! -f $rootdir/root/npm_install.sh ]; then
79
+        echo $'Unable to download npm installer'
80
+        exit 8793636
88
     fi
81
     fi
82
+    chroot "$rootdir" chmod +x /root/npm_install.sh
83
+    sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
84
+    chroot "$rootdir" /root/npm_install.sh
85
+
89
     if [ ! -f $rootdir/usr/bin/npm ]; then
86
     if [ ! -f $rootdir/usr/bin/npm ]; then
90
         echo $'npm was not installed'
87
         echo $'npm was not installed'
91
         exit 5290462
88
         exit 5290462
92
     fi
89
     fi
90
+    cp $rootdir/usr/bin/npm $rootdir/root/npm
93
 
91
 
94
     # update from the old debian nodejs version
92
     # update from the old debian nodejs version
95
     get_npm_arch
93
     get_npm_arch
96
     chroot "$rootdir" npm install --arch=$NPM_ARCH -g n@${NODEJS_N_VERSION} --save
94
     chroot "$rootdir" npm install --arch=$NPM_ARCH -g n@${NODEJS_N_VERSION} --save
97
     chroot "$rootdir" n --arch $N_ARCH ${NODEJS_VERSION}
95
     chroot "$rootdir" n --arch $N_ARCH ${NODEJS_VERSION}
98
-    chroot "$rootdir" npm install -g --arch $NPM_ARCH npm@${NPM_VERSION} --save
96
+    cp $rootdir/root/npm $rootdir/usr/bin/npm
99
 }
97
 }
100
 
98
 
101
 function remove_nodejs {
99
 function remove_nodejs {