MyGet npm support

After signing up for a MyGet account and creating a feed that serves as a Bower registry, you can work with Bower packages using the Bower command line and bower.json.

Your Bower registry URL

The full URL to your Bower feed on MyGet can be found on the feed details page.

Bower feed URL on MyGet

This URL can be used with any Bower-compatible client. Note that a pre-authenticated URL is also available for private Bower feeds.

The easiest way of registering the feed is running the following command:

echo {"registry": "https://www.myget.org/F/your-feed-name/bower/"} > .bowerrc

For private feeds, make sure to either use a pre-authenticated URL or include the username and password in the registry URL:

echo {"registry": "https://username:password@www.myget.org/F/your-feed-name/bower/"} > .bowerrc

Note: If you have any special characters in your username or password, such as an @ or a space, make sure to use the URL encoded value (e.g. `%40` for @, %23 for #, %2F for / and so on).

Using multiple Bower registries

By default, your MyGet Bower feed will only contain packages you have explicitly added, either using the web UI or the Bower client. To have the public Bower registry blended into your own, go to the Upstream Sources tab, edit the Bower.io upstream source and enable the Make all upstream packages available in clients option and the the Automatically add downloaded upstream packages to the current feed (mirror) option.

Note that using these settings it's also possible to blend more than one Bower registry into one.

Mix your Bower registry with the public Bower registry

Additionally, your .bowerrc file can be configured to search multiple feeds without requiring the feed to blend the feeds. Here's an example .bowerrc file that uses the public Bower registry and a MyGet feed to search for packages, and only supports registering packages with the MyGet feed:

{
  "registry": {
    "search": [
      "https://www.myget.org/F/your-feed-name/bower/",
      "https://bower.herokuapp.com"
    ],
    "register": "https://username:password@www.myget.org/F/your-feed-name/bower/"
  }
}

Registering Bower packages

If you want to register a Bower package with a registry, you usually run the bower register command. This is not different with MyGet: bower register will register your package with a MyGet feed.

Note: Make sure to use a pre-authenticated URL or include credentials in the registry URL if you want to register a package.

When this is done, any package can be registered on the MyGet Bower feed using the register command:

bower register moment https://github.com/moment/moment.git

Working with private Bower registries

If a MyGet Bower feed is marked as private, it will always require authentication. To setup authentication, make sure to either use a pre-authenticated URL or include the username and password in the registry URL:

echo {"registry": "https://username:password@www.myget.org/F/your-feed-name/bower/"} > .bowerrc

Note: If you have any special characters in your username or password, such as an @ or a space, make sure to use the URL encoded value (e.g. `%40` for @, %23 for #, %2F for / and so on).

Referencing Bower packages in bower.json

If you would like to reference packages, you can do so by using the package name and version in your bower.json file, or by using the URL to a specific version branch. For example:

{
  "name": "awesomeapplication",
  "description": "An awesome application",
  "version": "1.0.0",
  "repository": {
    "type": "git",
    "url": "git://github.com/foo/bar.git"
  },
  "dependencies": {
    "awesomepackage1": ">= 1.0.0",
    "awesomepackage2": "https://github.com/owner/package.git#branch"
  }
}

Running bower install will make sure any dependency is downloaded and installed.

Fixing certificate errors

You may want to run the SSL checker and verify your computer has all required certification authorities installed.

Company proxy server

When using a company proxy server, make sure to configure it correctly. Justin James has a great guide to npm, bower, git and bash proxy configurations available.

Found an issue with the documentation on this page? We accept contributions!
Read our contribution guidance or edit this page's source on GitHub.