npm


Overview

npm is the default package manager for Node.js, used for managing JavaScript and TypeScript packages. It allows you to share and reuse code across projects and teams.

Integrating npm with JFrog Fly allows you to manage your packages and releases from source code to production in a simple and native way, directly from your IDE.


Supported Clients

JFrog Fly supports npm packages built with:

  • npm CLI (npm publish, npm install) - The standard Node.js package manager included with Node.js

Upload / Publish Package

With Fly App

Activate npm in your Fly App to configure your .npmrc globally with Fly, then publish as usual:

npm publish

Manual Configuration

1. Generate an access token in Fly Token Management

2. Configure npm in your project or home directory. Create or edit .npmrc:

registry=https://<your-fly-subdomain>.jfrog.io/artifactory/api/npm/npm/
//<your-fly-subdomain>.jfrog.io/artifactory/api/npm/npm/:_authToken=<your-fly-token>

3. Publish:

npm publish

Note: You cannot publish a package version that already exists. To publish again, you must increment the version in your package.json.


Download / Install Package

With Fly App

Activate npm in your Fly App to configure your .npmrc globally with Fly, then install as usual:

npm install <package-name>

Manual Configuration

1. Generate an access token in Fly Token Management

2. Configure npm in your project or home directory. Create or edit .npmrc:

registry=https://<your-fly-subdomain>.jfrog.io/artifactory/api/npm/npm/
//<your-fly-subdomain>.jfrog.io/artifactory/api/npm/npm/:_authToken=<your-fly-token>

3. Install:

npm install <package-name>

From Public Registry

When you install a package that isn’t in your Fly Registry, JFrog Fly automatically fetches it from npmjs.org and caches it for future use.

npm install express

Publish/Install Packages with CI

To publish and install npm packages with CI, update your GitHub Actions workflow to include the Fly action.

Simply type in your IDE the prompt: “Configure my workflows with Fly” and Fly MCP will configure your GitHub Actions workflow yml file, as follows:

1. Add permissions (top level, after on:):

permissions:
  contents: read
  id-token: write

2. Add Fly Action (after actions/setup-node, before npm commands):

- name: JFrog Fly - Configure all your package managers to work with Fly registry
  uses: jfrog/fly-action@v1
  with:
    url: https://<your-fly-subdomain>.jfrog.io

GitHub Action Example

name: Build and Publish npm Package

on:
  push:
    branches: [main]

permissions:
  contents: read
  id-token: write

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'

      - name: JFrog Fly - Configure all your package managers to work with Fly registry
        uses: jfrog/fly-action@v1
        with:
          url: https://<your-fly-subdomain>.jfrog.io

      - name: Install dependencies
        run: npm install

      - name: Build
        run: npm run build

      - name: Publish
        run: npm publish

Back to Package Types →