-
-
Notifications
You must be signed in to change notification settings - Fork 28
3.1 Install nodejs and npm
Make sure to follow: 2.2 Install Essentials
sudo apt-get update && sudo apt-get install -y ca-certificates curl gnupg
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update && sudo apt-get install nodejs -y
apt update -y
apt upgrade -y
apt install -y build-essential curl
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
apt-get install -y nodejs
apt update -y
apt upgrade -y
apt install -y build-essential curl
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs
Node has a default max memory usage of less than 2GB on some 64bit systems. This can cause unexpected memory issues when running on CircleCI. It's possible to adjust the max memory ceiling using a command-line flag passed into Node:
--max-old-space-size=<memory in MB>
The flag can be difficult to ensure that it is being used, especially when node processes are forked. The best way to ensure this setting will be picked up by all node processes within the environment is to apply this setting directly to an environment variable, which can be done using Node. 8 or higher:
NODE_OPTIONS=--max-old-space-size=4096
Installing any other Version via nvm (Node-Version-Manager)
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
Running the above command downloads a script and runs it. The script clones the nvm repository to ~/.nvm
, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile
, ~/.zshrc
, ~/.profile
, or ~/.bashrc
).
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
To download, compile, and install the latest release of node, do this:
nvm install node # "node" is an alias for the latest version
To install a specific version of node:
nvm install 16.13.0 # or 17.1.0, 8.9.1, etc
The first version installed becomes the default. New shells will start with the default version of node (e.g., nvm alias default
).
You can list available versions using ls-remote
:
nvm ls-remote
And then in any new shell just use the installed version:
nvm use node
nvm use 16.13.0
nvm alias default 16.13.0
-
1 All needed Console Commands
- 1.1 Directory Navigation
- 1.2 System Information
- 1.3 Hardware Information
- 1.4 File and Directory Cmds
- 1.5 Process Management
- 1.6 File Permissions
- 1.7 Networking
- 1.8 Archives (Tar Files)
- 1.9 Search
- 1.10 File Transfers
- 1.11 Disk Usage
- 1.12 User Information and Management
- 1.13 Speedtest
- 1.14 Clear Cache
- 1.15 Disable Sleeping Processes (Suspending)
- 1.16 Remove Welcome Message