Skip to main content

JavaScript

This guide covers setting up JavaScript development with Node.js and pnpm.

Installation

We recommend Node.js LTS (Long Term Support).

# Using winget
winget install OpenJS.NodeJS.LTS

# Or using Chocolatey
choco install nodejs-lts

Or download the installer from nodejs.org.

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

  1. Go to https://p6m.jfrog.io
  2. Login
  3. Navigate to Profile → Set Me Up → npm
  4. Click Generate Token and Create Instructions
  5. 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"