Node.js Environment Setup for CosmicAC
Install NVM, Node.js 20, and required global packages at user level for CosmicAC deployment.
Node.js Environment Setup for CosmicAC
All dependencies are installed at the user level (not system-wide) using NVM.
Install NVM (Node Version Manager)
# Download and install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# Reload shell configuration
source ~/.bashrc
# or
source ~/.profile
# Verify NVM installation
nvm --versionInstall Node.js 20
# Install Node.js 20 LTS
nvm install 20
# Set Node 20 as default
nvm alias default 20
# Verify installation
node --version # Should output: v20.x.x
npm --version # Should output: 10.x.xInstall Global Packages (User Level)
# Install PM2 (process manager)
npm install -g pm2
# Install hp-rpc-cli (RPC command line tool)
npm install -g hp-rpc-cli
# Verify installations
pm2 --version
npx hp-rpc-cli --version
# Setup PM2 startup script (optional - for auto-restart on reboot)
pm2 startup
# Follow the instructions output by the commandVerify Environment
# Run this to confirm everything is set up correctly
echo "Node: $(node --version)"
echo "NPM: $(npm --version)"
echo "PM2: $(pm2 --version)"
echo "hp-rpc-cli: $(npx hp-rpc-cli --version 2>/dev/null || echo 'installed')"
echo "User: $(whoami)"
echo "Home: $HOME"