Installing npm on mesh image
This commit is contained in:
parent
44d8d33d56
commit
d0eb13b5ec
|
@ -74,28 +74,26 @@ function mesh_install_nodejs {
|
|||
exit 7235728
|
||||
fi
|
||||
|
||||
if [ -f /usr/share/npm/bin/npm-cli.js ]; then
|
||||
ln -s /usr/share/npm/bin/npm-cli.js /usr/bin/npm
|
||||
else
|
||||
wget https://www.npmjs.com/install.sh -O $rootdir/root/npm_install.sh
|
||||
if [ ! -f $rootdir/root/npm_install.sh ]; then
|
||||
echo $'Unable to download npm installer'
|
||||
exit 8793636
|
||||
fi
|
||||
chroot "$rootdir" chmod +x /root/npm_install.sh
|
||||
sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
|
||||
chroot "$rootdir" /root/npm_install.sh
|
||||
wget https://www.npmjs.com/install.sh -O $rootdir/root/npm_install.sh
|
||||
if [ ! -f $rootdir/root/npm_install.sh ]; then
|
||||
echo $'Unable to download npm installer'
|
||||
exit 8793636
|
||||
fi
|
||||
chroot "$rootdir" chmod +x /root/npm_install.sh
|
||||
sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
|
||||
chroot "$rootdir" /root/npm_install.sh
|
||||
|
||||
if [ ! -f $rootdir/usr/bin/npm ]; then
|
||||
echo $'npm was not installed'
|
||||
exit 5290462
|
||||
fi
|
||||
cp $rootdir/usr/bin/npm $rootdir/root/npm
|
||||
|
||||
# update from the old debian nodejs version
|
||||
get_npm_arch
|
||||
chroot "$rootdir" npm install --arch=$NPM_ARCH -g n@${NODEJS_N_VERSION} --save
|
||||
chroot "$rootdir" n --arch $N_ARCH ${NODEJS_VERSION}
|
||||
chroot "$rootdir" npm install -g --arch $NPM_ARCH npm@${NPM_VERSION} --save
|
||||
cp $rootdir/root/npm $rootdir/usr/bin/npm
|
||||
}
|
||||
|
||||
function remove_nodejs {
|
||||
|
|
Loading…
Reference in New Issue