-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnodejs.sh
More file actions
executable file
·27 lines (21 loc) · 864 Bytes
/
nodejs.sh
File metadata and controls
executable file
·27 lines (21 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
set -e
source /pd_build/buildconfig
set -x
VERSION=${1:-22}
if ( ! egrep -q nodesource.gpg /etc/apt/sources.list.d/nodesource.list ); then
## Install Node.js (also needed for Rails asset compilation)
header "Installing NodeJS ${VERSION}"
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --batch --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
apt-get update
minimal_apt_get_install nodejs
echo "+ Updating npm"
run npm update npm -g || ( cat /root/.npm/_logs/*-debug.log && false )
if [[ ! -e /usr/bin/node ]]; then
ln -s /usr/bin/nodejs /usr/bin/node
fi
## create corepack command symlinks (yarn, etc)
corepack enable
fi