Files
runner-images/images/linux/scripts/installers/nodejs.sh
T

36 lines
1.2 KiB
Bash
Raw Normal View History

2020-10-07 13:49:40 +05:00
#!/bin/bash -e
2019-11-15 15:23:41 -05:00
################################################################################
## File: nodejs.sh
## Desc: Installs Node.js LTS and related tooling (Gulp, Grunt)
2019-11-15 15:23:41 -05:00
################################################################################
2021-02-26 20:06:24 +05:00
# Source the helpers for use with the script
source $HELPER_SCRIPTS/install.sh
2019-11-15 15:23:41 -05:00
# Install LTS Node.js and related build tools
2020-02-07 15:17:43 +03:00
curl -sL https://raw.githubusercontent.com/mklement0/n-install/stable/bin/n-install | bash -s -- -ny -
2019-11-15 15:23:41 -05:00
~/n/bin/n lts
2021-02-26 20:06:24 +05:00
# Install node modules
node_modules=$(get_toolset_value '.node_modules[].name')
# remove commenting out of this line as nmp migrated to v7
# npm install -g $node_modules
2021-02-26 20:06:24 +05:00
# TODO: workaround for Netlify CLI with npm6. Remove 19-28 and uncomment 17 if migration to npm7 compelted
for module in $node_modules; do
echo "Installing node module $module"
if [ $module = "netlify-cli" ];then
# Install the Netlify CLI using --unsafe-perm=true options to avoid permission issues
npm install -g --unsafe-perm=true $module
else
npm install -g $module
fi
done
echo "Creating the symlink for [now] command to vercel CLI"
ln -s /usr/local/bin/vercel /usr/local/bin/now
2019-11-15 15:23:41 -05:00
rm -rf ~/n
2021-02-26 20:06:24 +05:00
invoke_tests "Node" "Node.js"