Dela via


Publish npm packages from the command line

TFS 2017

Follow this quick tutorial to learn how to connect your npm client to your feed and publish your packages using the command line. If you don't have a feed yet, you can follow the steps in the quickstart to Create your own feed.

Project setup

  1. From within your project, select Artifacts and then select Connect to feed.

  2. Select npm and then follow the instructions under Project setup to configure your .npmrc file.

    Screenshot showing how to set up your project

Publish npm packages

  1. Open a command prompt window and navigate to the directory that contains your package.json. If you don't have a package.json file, run the following command:

    npm init 
    
  2. Run the following command in your project directory to publish your npm packages:

    npm publish
    

Restore npm packages

  1. Run the following command in your project directory to restore your npm packages:

    npm install