npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

npmrc-switch

v1.0.0

Published

Allows switching between different .npmrc files.

Readme

npmrc-switch

npmrc-switch is a CLI tool to save, load, and manage different npm configurations.

Why Does this Exist?

Primarily, because I wanted to learn the process of publishing npm packages and building JS executables.

Where I work, we have some pretty crazy proxy and VPN rules that make it difficult trying to get the right configuration for different package management systems. We have different networks and VPNs which have access to different external sources and internal proxies. Sometimes public registries are available, othertimes they are not. The goal of this project is to alleviate the pain of switching between different npm configurations for those environments.

Basic Usage

Let's put the CLI through some paces to see what it does and how it performs.

Building Our Configuration & Saving It

Let's say we have a registry that is super insecure, but we still want to connect with it. We don't want to always use the insecure registry, but its repeatable enough that we don't want to keep (un)commenting or (un)setting configuration values. This is a great place for npmrc-switch, because we can jump between configurations for the insecure registry and the standard npm registry.

Let's assume you are starting off with a fresh configuration. If you aren't then read through, and feel free to save and clear to get to this point.

Let's add some npm configurations and save it, as test-config.

# Turn off strict-ssl, as an example
$ npm config set strict-ssl false

# Save the configuration
$ npmrc-switch save test-config

View Our Configuration(s)

Let's double check that our configuration is good and set. We can do this with the view command. view takes a name argument for the configuration to show. If passed current, it will give the current .npmrc file. If given all, then it will show all saved configurations.

$ npmrc-switch view test-config

Clear our NPM Configuration 😱

Oh no! We are going to nuke our .npmrc?!? Yup. To prove a point. npmrc-switch has a command to do this.

$ npmrc-switch clear

Load Back Our Configuration

Let's load back our saved configuration using the load command. It takes the name of the configuration to load.

$ npmrc-switch load test-config

Delete Our Saved Configuration

Now that we are back to where we want to be, we can delete our configuration. This isn't recommended if we needed the configuration again, but hey, maybe this insecure registry finally got shut down, so we won't need it anymore. Let's use the delete command.

$ npmrc-switch delete test-config

How to Install

Follow either the global or npx install below. Its like choose your own adventure games, but much less exciting.

Installing Globally

$ npm install -g npmrc-switch
# Or with sudo if needed
$ npm install -g npmrc-switch

# Run the command
$ npmrc-switch --help

Using NPX

# Just remove the help and add your commands
$ npx npmrc-switch --help

Alias for Easier Use

Consider adding this to your .bashrc, .zshrc, or .profile to make it easier to run.

# If installed
alias ns="npmrc-switch"
# If using npx
alias ns="npx npmrc-switch"