Use packages from npmjs.com
Support for npm packages is available with Package Management in VSTS and TFS 2017 Update 1 and newer.
The npm client is designed to work with a single primary registry (what Package Management calls a feed). It also supports secondary scoped registries. Scoped registries can only be used to install packages whose names begin with the scope prefix, so their usage is more restrictive. If you want to use both private packages you've created and public packages from npmjs.com, we recommend using upstream sources.
The npmjs.com upstream source allows you to merge the contents of npmjs.com into your feed such that the npm client can install packages from both locations. Enabling upstream sources also automatically enables saving of packages you use from the upstream source. This is the recommended way to use Package Management with npm. Upstreams give you the most flexibility to use a combination of scoped- and non-scoped packages in your feed, as well as scoped- and non-scoped packages from npmjs.com.
To learn more about the concept of upstream sources, please see the concepts page.
Enable npmjs.com as an upstream
To use npmjs.com as an upstream source, either create a new feed or edit an existing feed.
On a new feed
- Create a new feed. Ensure you leave the "Use packages from public sources through this feed" radio button selected.
On an existing feed
- Edit your feed. Select the gear icon in the top right of the page to open feed settings.
- Select the Upstream sources pivot.
- Select Add upstream source in the CommandBar.
- Select Select a feed URL and select npmjs.com (https://registry.npmjs.org). If you like, customize the upstream name.
- Select Add.
Filter to saved packages
You can see the packages you have saved in your feed by selecting the "Source = npmjs.com" filter.
Right now, VSTS and TFS do not provide a guarantee that every package
npm installed via a feed with upstreams enabled will be cached.
If you prefer to use scopes, which limit your private packages to those with the
@<scope> prefix e.g.
@fabrikam/core but enable you to consume public packages directly from npmjs.com, see Scopes.