Userscript: npmc

npmc (npm package manager chooser) is a userscript that allows you to choose the package manager and flags to use when copying an installation command on


When you first install the userscript and visit an npm package page, you’ll notice that in the sidebar on the right, a few things have changed.

The single copy button, npm i <package>, has been replaced by two different, cleaner buttons, one for yarn and another for pnpm. These are just the defaults and can be easily changed.

Below that sidebar, there’s a button labeled ‘npmc settings’. If you click on it, you’ll see a dialog appear.

From here, you can add a copy configuration, delete one, or reset to the provided defaults (note that multiple flags can be selected, even though selecting dev and global together isn’t generally useful). For example, I use pnpm, so I use this configuration:

This replaces the single npm copy button with three separate copy buttons, all for pnpm.

Currently, only dev and global flags are supported.

Leave a Reply

Your email address will not be published. Required fields are marked *