แก้ไข

แชร์ผ่าน


How to install Azure library packages for JavaScript

The Azure SDK for JavaScript is composed of many independently versioned libraries that can be installed in standard JavaScript environments. This modular approach allows you to install only the packages you need and manage them individually for better control over dependencies and updates.

Libraries for standard JavaScript environments are listed in the package index, and all Azure packages are published under the @azure and @azure-rest scopes. These packages are maintained by Microsoft and can be found on npm under the publisher microsoft1es. This structure enables you to easily provision and manage Azure resources using management libraries (with names starting with @azure/arm-) and interact with these resources from your application code.

Prerequisites

If you run into problems while installing packages, refer to our troubleshooting guide.

Install the latest version of a library

When you install a library without specifying a version, the package manager retrieves the latest version available from the package index.

npm install <library>

Install specific library versions

Sometimes you may need to install a particular version or a preview version of a library for compatibility testing or to gain early access to new features. When you install a specific version, you are pinning your dependency, which means that your project will continue using that version and will not automatically receive updates or fixes. While pinning can be useful in certain scenarios, we generally recommend using the latest version whenever possible to benefit from ongoing improvements and security updates.

npm install <library>@<version-number>

Preview packages

When installing preview packages, look for prerelease tags. These packages provide early access to new features but might not be as stable as general releases. For example:

  • next: This tag is used for the current beta version of the upcoming release.
  • dev: This tag is used for the current alpha version of the upcoming release.

Verify a library installation

After installation, you can verify that the correct version of the library is installed.

npm list <library>

Uninstall a library

npm uninstall <library>

Troubleshooting

  • Installation errors: Ensure that Node.js and your package manager (npm or yarn) are up-to-date.
  • Version conflicts: Check that the version specified is available in the package index.
  • Network issues: Verify your internet connection and proxy settings if package downloads are slow or failing.

Additional resources