Fixing npm hell
This commit is contained in:
parent
01679feef4
commit
2b9c6c3fa3
|
@ -13,7 +13,7 @@
|
|||
# License
|
||||
# =======
|
||||
#
|
||||
# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
|
||||
# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -57,14 +57,12 @@ function mesh_install_nodejs {
|
|||
|
||||
cat <<EOF > ${rootdir}/root/install-nodejs.sh
|
||||
#!/bin/bash
|
||||
PATH="/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/bin"
|
||||
NODE_PATH="/usr/lib/node_modules"
|
||||
cp /usr/bin/nodejs /usr/local/bin/node
|
||||
cp /usr/bin/nodejs /usr/bin/node
|
||||
#/usr/bin/curl -0 -L https://npmjs.org/install.sh | sh
|
||||
npm install -g npm@${NPM_VERSION} --save
|
||||
npm install -g n@${NODEJS_N_VERSION} --save
|
||||
n ${NODEJS_VERSION}
|
||||
exit 0
|
||||
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
|
||||
cp /usr/bin/nodejs /usr/local/bin/node
|
||||
EOF
|
||||
chroot "${rootdir}" chmod +x /root/install-nodejs.sh
|
||||
chroot "${rootdir}" /root/install-nodejs.sh
|
||||
|
@ -173,44 +171,13 @@ function install_nodejs {
|
|||
exit 63962
|
||||
fi
|
||||
|
||||
cp /usr/bin/nodejs /usr/local/bin/node
|
||||
cp /usr/bin/nodejs /usr/bin/node
|
||||
|
||||
npm install -g n@${NODEJS_N_VERSION} --save
|
||||
if [ ! -f /usr/local/bin/n ]; then
|
||||
exit 325723
|
||||
fi
|
||||
cp /usr/local/bin/n /usr/bin/n
|
||||
n ${NODEJS_VERSION}
|
||||
if [ ! -f /usr/local/bin/node ]; then
|
||||
exit 347835
|
||||
fi
|
||||
cp /usr/local/bin/node /usr/bin/nodejs
|
||||
cp /usr/local/bin/node /usr/bin/node
|
||||
if [ -f /usr/local/lib/node_modules/npm ]; then
|
||||
rm -rf /usr/local/lib/node_modules/npm
|
||||
fi
|
||||
if [ -d /usr/local/lib/node_modules/npm ]; then
|
||||
rm -rf /usr/local/lib/node_modules/npm
|
||||
fi
|
||||
npm install -g npm@${NPM_VERSION} --save
|
||||
if [ ! -f /usr/local/bin/npm ]; then
|
||||
if [ ! -f /usr/bin/npm ]; then
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
if [ -f /usr/local/bin/npm ]; then
|
||||
cp /usr/local/bin/npm /usr/bin/npm
|
||||
fi
|
||||
npm install -g n@${NODEJS_N_VERSION} --save
|
||||
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
|
||||
|
||||
# second npm install attempt seems necessary
|
||||
npm install -g npm@${NPM_VERSION} --save
|
||||
if [ -f /usr/local/bin/npm ]; then
|
||||
cp /usr/local/bin/npm /usr/bin/npm
|
||||
fi
|
||||
cp /usr/bin/nodejs /usr/local/bin/node
|
||||
|
||||
# node seems tricky so here we're going to double check
|
||||
# that the versions we expect did get installed
|
||||
|
|
Loading…
Reference in New Issue