Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

npm (Node.js)

view on GitHub

npm (Node Package Manager) is the widely used package manager for JavaScript, enabling developers to manage and share libraries, frameworks, and utilities.

Using ProGet Feeds as npm repositories will let you to consolidate your package management and maintain control over which packages are used in your organization. In addition to publishing and hosting your private npm packages, ProGet can serve as a proxy for public npm repositories, helping you cache and control dependencies that are pulled from npmjs.com.

This page covers setting up npm and Yarn clients with ProGet. Additionally, you can also use pnpm with ProGet. The commands are similar, but we recommend reading the official documentation for details.

Adding an npm Feed as a Source

To publish and install packages from your npm feed in ProGet, you'll need to add it as a source in your npm client. To do this you will need to use the npm config set registry command:

$ npm config set registry http://«proget-url»/npm/«feed-name»

Or in Yarn, by using the yarn config set registry command:

$ yarn config set registry http://«proget-url»/npm/«feed-name»

You can confirm that the feed has been set correctly by using npm get registry for npm, yarn config get registry for Yarn.

For more information, as well as how to proxy npm packages, you can read our HOWTO: Proxy Packages from the npm Registry in ProGet guide.

Authenticating to npm Feeds

By default, npm feeds in ProGet do not require authentication and can be viewed anonymously. However, you can set a feed to require authentication to access.

Feeds can be authenticated with a username and password string «username»:«password» but we strongly recommend using an API key instead. You can read more about creating one on our API Key page.

When creating an API Key, fill in the fields by selecting "Feeds ("Use Certain Feeds)" as the "Feed Type" and selecting the Conda feed to authenticate to. Make sure that the required permission boxes are checked, and then select "Save".

To authenticate you'll need to add an _auth token. This is the string api:«api-key» (or «username»:«password») that's been base64-encoded.

[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("api:«api-key»")) 

Or press F12 to open the Developer Tools, click on the "Console", then run the following script:

btoa('api:«api-key»')

If you previously have configured your npm feed to use an npm audit proxy and want to use ProGet's vulnerability details instead, you will need to change the npm audit settings on your feed's Manage Feed page.

Please note that partial name searches may not return any values from your GitHub connector since GitHub has not implemented the search API.