2020-10-07 13:49:40 +05:00
|
|
|
#!/bin/bash -e
|
2019-11-15 15:23:41 -05:00
|
|
|
################################################################################
|
2023-11-22 21:49:23 +01:00
|
|
|
## File: install-nodejs.sh
|
|
|
|
|
## Desc: Install 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
|
|
|
|
|
|
2021-10-30 14:56:36 +03:00
|
|
|
# Install default Node.js
|
2023-12-29 12:36:27 +01:00
|
|
|
default_version=$(get_toolset_value '.node.default')
|
2023-07-28 20:18:41 +02:00
|
|
|
curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n -o ~/n
|
2023-12-29 12:36:27 +01:00
|
|
|
bash ~/n $default_version
|
2021-10-30 14:56:36 +03:00
|
|
|
|
2021-02-26 20:06:24 +05:00
|
|
|
# Install node modules
|
|
|
|
|
node_modules=$(get_toolset_value '.node_modules[].name')
|
2021-12-10 10:38:30 +01:00
|
|
|
npm install -g $node_modules
|
2021-02-09 18:57:05 +03:00
|
|
|
|
|
|
|
|
echo "Creating the symlink for [now] command to vercel CLI"
|
|
|
|
|
ln -s /usr/local/bin/vercel /usr/local/bin/now
|
|
|
|
|
|
2021-07-16 10:55:47 +03:00
|
|
|
# fix global modules installation as regular user
|
2022-08-10 13:55:34 +01:00
|
|
|
# related issue https://github.com/actions/runner-images/issues/3727
|
2021-07-16 10:55:47 +03:00
|
|
|
sudo chmod -R 777 /usr/local/lib/node_modules
|
|
|
|
|
sudo chmod -R 777 /usr/local/bin
|
|
|
|
|
|
2019-11-15 15:23:41 -05:00
|
|
|
rm -rf ~/n
|
|
|
|
|
|
2021-02-26 20:06:24 +05:00
|
|
|
invoke_tests "Node" "Node.js"
|