Get started with npm Package Management in Team Services

Last Update: 4/25/2017

Before you start

This guide assumes you've already set up Package Management. You can check out how to install and license the extension in the Install and license Package Management guide, or go directly to the Extensions Marketplace listing to install.

Availability
npm Package Management is available with Visual Studio Team Services and TFS 2017 Update 1 and newer.

Create a feed

Already have a feed? Skip to the next step.

A feed is a container for packages. You consume and publish packages through a particular feed.

To get started, navigate to the Package hub in the Build & Release hub group:

Go to Package hub

If you don't see the Package hub, then ask your account owner to install the Package Management extension from the Visual Studio Marketplace.

Click the dropdown in the top left and select New feed:

New feed button

In the dialog:

  • Give the feed a name and a description (optional).
  • Choose who can read and contribute (or update) packages in your feed. The default selections give Team Build access so that continuous integration builds can add and update packages.
  • When you're done, choose Create.

New feed dialog

You can change these settings later by editing the feed.

Set up your npmrc

  1. Navigate to your feed. If you haven't created a feed, create one now.
  2. Select Connect to feed.
  3. Select npm.
  4. Follow the steps on the screen.

Connect to feed button in the upper-right of the page

Team Services

npm configuration in the Connect to feed dialog

Team Foundation Server

npm configuration in the Connect to feed dialog

Publish a package

Publish npm packages to a feed in Package Management to share them with your team and your organization.

  1. Set up the npm client with your feed.
  2. Open a shell and navigate to the directory that contains your package's package.json. If you don't have a package.json, run npm init (see the npm CLI docs).
  3. Push your package by running npm publish.

See the npm CLI docs for more publish options.

Install your package

Install npm packages from your feed, and also from npmjs.com if you've configured upstream sources, using the npm client.

  1. Set up the npm client with your feed.
  2. Open a shell and navigate to the directory that contains your project's package.json.
  3. Install a package by running npm install --save <package>.

See the npm CLI docs for more install options.

Automate the process with continuous integration

You can use continuous integration systems like Team Build to automate the packing and publishing of your packages. To get started with continuous integration, see the Continuous delivery overview

What's next?

For more advanced topics, check out the content summary.