- NodeJS v20
For linux user, NodeJS v20 only compatible for Ubuntu 20.x (VPS)
sudo apt update -y
sudo apt install -y ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils-
Login as root:
sudo -s -
Create destination folder:
mkdir -p /usr/local/nvm -
Install nvm:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | NVM_DIR=/usr/local/nvm bash -
Create a file called
nvm.shin/etc/profile.dwith the following contents:#!/usr/bin/env bash export NVM_DIR="/usr/local/nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
or automatically using shell terminal:
sudo tee /etc/profile.d/nvm.sh > /dev/null <<'EOF' export NVM_DIR="/usr/local/nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" EOF
-
Set permissions
chmod 755 /etc/profile.d/nvm.sh -
Run
/etc/profile.d/nvm.shor load within current shell. /etc/profile.d/nvm.shorsource /etc/profile.d/nvm.sh -
Install node:
nvm install v20 -
Compile & symlink Node from
nvmNODE_BIN_DIR="$(dirname $(nvm which 20))" sudo ln -sf "$NODE_BIN_DIR/node" /usr/local/bin/node sudo ln -sf "$NODE_BIN_DIR/npm" /usr/local/bin/npm sudo ln -sf "$NODE_BIN_DIR/npx" /usr/local/bin/npx sudo ln -sf "$NODE_BIN_DIR/corepack" /usr/local/bin/corepack
Then all users just run
node/npmwithout caring aboutnvm.
# Install requirements
sudo apt install -y ca-certificates curl gnupg
# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# Download and install Node.js:
nvm install 20
# Verify the Node.js version:
node -v # Should print "v20.18.1".
nvm current # Should print "v20.18.1".
# Download and install Yarn:
corepack enable yarn
# Verify Yarn version:
yarn -v# Create user
sudo usermod -s /bin/bash www-data
# Switch user
sudo -u www-data -i
# Add service support
sudo usermod -s /usr/sbin/nologin www-dataChange to root user, make sure ownership of /var/www/html to www-data
sudo chown -R www-data:www-data /var/www/htmlSwitch to user www-data, then install NVM
# Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# Download and install NodeJS
nvm install 20
# Download and install yarn
corepack enable yarn
# Load NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm --versionBuild project environment
rollup -c && rollup -c # build twice ONLY for first run
rollup -c rollup.php.jsNVM for Windows is a separate project from the Linux/Mac version. It allows you to easily manage and switch between Node.js versions on Windows.
Go to the NVM for Windows releases page and download the latest nvm-setup.zip or nvm-setup.exe installer.
Run the installer and follow the prompts. Accept the default installation paths unless you have a specific need to change them.
After installation, open a new cmd.exe window to ensure NVM is available in your PATH.
nvm install 20
nvm use 20
node -v # Should print a version like v20.x.x
npm -v # Should print the npm versionnpm install -g yarn
yarn -vFor more details, see the NVM for Windows documentation.
Run below command after run yarn dev:vite on another terminal/cmd
npx cloudflared tunnel --url https://localhost:5173 --no-tls-verifyTo get list of your tunnels, use
cloudflared tunnel list
Create One dash zero trust token
npx cloudflared service install <YOUR_CLOUDFLARED_TOKEN>
npx cloudflared tunnel route dns <YOUR_TUNNEL_NAME> your.domain.com
cloudflared tunnel --config cloudflared.config.yaml run <YOUR_TUNNEL_NAME> # dont forget to edit yaml file
# or
cloudflared tunnel run --token <YOUR_CLOUDFLARED_TOKEN>when confused, try delete and create forcibly
cloudflared tunnel delete --force mytunnel
cloudflared tunnel list # No tunnels were found for the given filter flags. You can use 'cloudflared tunnel create' to create a tunnel.
cloudflared tunnel create mytunnel # Tunnel credentials written to C:\Users\<name>\.cloudflared\<tunnel-id>.json. cloudflared chose this file based on where your origin certificate was found. Keep this file secret. To revoke these credentials, delete the tunnel.
cloudflared tunnel route dns mytunnel your.domain.com # when fail tunnel, try replace manual DNS CNAME for you domain with format <TUNNEL-ID>.cfargotunnel.com
# now edit file cloudflared.config.yaml with your credential information
# then run
cloudflared tunnel --config cloudflared.config.yaml run mytunnel