JavaScript
This guide covers setting up JavaScript development with Node.js and pnpm.
Installation
We recommend Node.js LTS (Long Term Support).
- Windows
- macOS
- Linux
# Using winget
winget install OpenJS.NodeJS.LTS
# Or using Chocolatey
choco install nodejs-lts
Or download the installer from nodejs.org.
# Using Homebrew
brew install node@20
# Add to PATH if needed
echo 'export PATH="/opt/homebrew/opt/node@20/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# Add NodeSource repository (Ubuntu/Debian)
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
# Install Node.js
sudo apt-get install -y nodejs
Verify Installation
node --version
npm --version
pnpm
pnpm is a fast, disk space efficient package manager. We recommend it over npm.
Install pnpm
npm install -g pnpm
Common pnpm Commands
# Initialize a new project
pnpm init
# Install dependencies
pnpm install
# Add a dependency
pnpm add lodash
# Add a dev dependency
pnpm add -D typescript
# Run scripts
pnpm dev
pnpm build
pnpm test
Set Up pnpm with JFrog
- Go to https://p6m.jfrog.io
- Login
- Navigate to Profile → Set Me Up → npm
- Click Generate Token and Create Instructions
- Follow the instructions to configure your
.npmrc:
pnpm config set registry https://p6m.jfrog.io/artifactory/api/npm/npm/
pnpm config set //p6m.jfrog.io/artifactory/api/npm/npm/:_authToken "your-token"
Related
- Node.js Documentation - Official Node.js documentation
- npm Configuration - Configure npm registries