Different way of installing nodejs

This commit is contained in:
Bob Mottram 2017-09-18 23:44:12 +01:00
parent 14f8abf596
commit 0871350f21
1 changed files with 48 additions and 39 deletions

View File

@ -169,49 +169,58 @@ function install_nodejs {
return
fi
if [ ! -f /usr/bin/nodejs ]; then
if [ ! $ARCHITECTURE ]; then
ARCHITECTURE=$(uname -m)
fi
rootdir=
mesh_install_nodejs
#if [ ! -f /usr/bin/nodejs ]; then
# Note: this has to be jessie for now
wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key > /root/node.gpg.key
apt-key add /root/node.gpg.key
echo "deb https://deb.nodesource.com/node_6.x jessie main" > /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/node_6.x jessie main" >> /etc/apt/sources.list.d/nodesource.list
# wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key > /root/node.gpg.key
# apt-key add /root/node.gpg.key
# echo "deb https://deb.nodesource.com/node_6.x stretch main" > /etc/apt/sources.list.d/nodesource.list
# echo "deb-src https://deb.nodesource.com/node_6.x stretch main" >> /etc/apt/sources.list.d/nodesource.list
apt-get update
# apt-get update
apt-get -yq remove --purge nodejs
# apt-get -yq remove --purge nodejs
if [ -d /usr/local/lib/node_modules ]; then
rm -rf /usr/local/lib/node_modules
fi
if [ -f /usr/local/bin/node ]; then
rm /usr/local/bin/node
fi
if [ -f /usr/bin/node ]; then
rm /usr/bin/node
fi
if [ -f /usr/bin/nodejs ]; then
rm /usr/bin/nodejs
fi
# if [ -d /usr/local/lib/node_modules ]; then
# rm -rf /usr/local/lib/node_modules
# fi
# if [ -f /usr/local/bin/node ]; then
# rm /usr/local/bin/node
# fi
# if [ -f /usr/bin/node ]; then
# rm /usr/bin/node
# fi
# if [ -f /usr/bin/nodejs ]; then
# rm /usr/bin/nodejs
# fi
apt-get -yq install nodejs
apt-get -yq install curl
# apt-get -yq install nodejs
# apt-get -yq install curl
if [ ! -f /usr/bin/nodejs ]; then
echo $'nodejs was not installed'
exit 63962
fi
fi
# if [ ! -f /usr/bin/nodejs ]; then
# echo $'nodejs was not installed'
# exit 63962
# fi
#fi
npm install -g npm@${NPM_VERSION} --save
npm install -g n@${NODEJS_N_VERSION} --save
n ${NODEJS_VERSION}
npm install -g pug@2.0.0-beta6 --save
npm install -g graceful-fs@4.1.10 --save
npm install -g minimatch@3.0.3 --save
#npm install -g npm@${NPM_VERSION} --save
#npm install -g n@${NODEJS_N_VERSION} --save
#n ${NODEJS_VERSION}
#npm install -g pug@2.0.0-beta6 --save
#npm install -g graceful-fs@4.1.10 --save
#npm install -g minimatch@3.0.3 --save
npm install -g npm@${NPM_VERSION} --save
cp /usr/local/bin/node /usr/bin/nodejs
#cp /usr/local/bin/node /usr/bin/nodejs
if [ -f /usr/local/bin/npm ]; then
cp /usr/local/bin/npm /usr/bin/npm
fi
# node seems tricky so here we're going to double check
# that the versions we expect did get installed