Compartir vía


Get started with npm packages in Azure Artifacts

TFS 2018

Using Azure Artifacts, you can publish and download npm packages from feeds and public registries like npmjs.com. This quickstart will walk you through the process of creating your feed, configuring your project, and publishing and downloading npm packages to and from your Azure Artifacts feed.

License the Azure Artifacts extension

If the Azure Artifacts extension has been removed, you can install it from the Visual Studio Marketplace. Each organization gets five free licenses. If you need more than five licenses, go to the Visual Studio Marketplace, and select Get it free.

If you aren't sure, you can select Start 30-day free trial. Every user in your organization is then granted access to Azure Artifacts for 30 days. After the 30-day trial period, your organization reverts back to five entitled users, and you must assign licenses to individual users. If you need additional licenses at this point, you can purchase them from Visual Studio Marketplace. If you have a license for Visual Studio Enterprise, you already have access to Azure Artifacts and don't need to be assigned a license. Just ensure that you've been assigned the "Visual Studio Enterprise" access level.

Note

If you selected Start 30 day free trial and are still in the trial period, every user is granted access. Licenses don't need to be assigned until the trial period ends.

  1. From any collection in Team Foundation Server, hover over the settings menu and select Users. Then select Package Management.

    Screenshot showing the user page in TFS 2018

  2. Select Assign, enter the users you want to assign licenses, and then select OK.

    • Users with Visual Studio Enterprise subscriptions get Azure Artifacts for free. Make sure that your Visual Studio Enterprise subscribers have the appropriate access level. For more information, see Change access levels.

    • Users who are using an instance of Team Foundation Server that's disconnected from the internet (and thus can't purchase licenses from Visual Studio Marketplace) can still assign licenses purchased through an enterprise agreement.

Create a feed

A feed is an organizational construct that allows users to store their packages and control who can access them. Azure Artifacts support storing several package types in a single feed such as NuGet, npm, Maven, Python, Cargo, and Universal packages.

Azure Artifacts comes pre-installed in TFS 2018. If this is your first time using your feed, you might be prompted to assign a license.

  1. Navigate to your project http://ServerName:8080/tfs/DefaultCollection/<ProjectName>.

  2. Select Build & Release, and then select Packages.

  3. Select + New feed to create a new feed.

  4. Provide a meaningful Name and Description for your feed. Specify the permissions for who can read and who can contribute, and decide whether to Include external packages.

  5. Select Create when you're done.

    A screenshot showing how to create a new feed in TFS 2018.

Connect to feed

  1. Navigate to your project http://ServerName:8080/tfs/DefaultCollection/<ProjectName>.

  2. Select Build & Release, and then select Packages.

  3. Select Connect to feed, and then select npm.

  4. Select Generate npm credentials. Copy the credentials and add them to your user-level .npmrc file.

    A screenshot showing how to generate npm credentials in TFS 2018.

Publish packages

To publish your npm package, run the following command in your project directory:

npm publish

Important

Using the publishConfig property to override the registry config param at publish-time is not supported.

Restore packages

To restore an npm package, run the following command in your project directory:

npm install --save <package>

To restore all your npm packages, run the following command from your project directory:

npm install