`vsts-npm-auth` is a command-line tool designed to assist Windows users in authenticating with private npm feeds hosted in Azure Artifacts. Its primary function is to acquire and manage authentication tokens, writing them to the user's `.npmrc` file to enable seamless package installation and publication to Azure DevOps feeds. The package's current stable version is 0.43.0, last published in May 2023. This tool is notably Windows-only and has critical limitations regarding cross-platform support and token management. Community consensus and various reports strongly advise against its use due to its closed-source nature, lack of transparency regarding contributors, and security concerns. Newer, cross-platform alternatives like `ado-npm-auth` or `azure-devops-npm-auth`, along with direct Personal Access Token (PAT) configuration, are generally recommended for more robust and secure authentication with Azure Artifacts. The official documentation also outlines manual PAT setup for non-Windows environments.
npm install vsts-npm-authVerified import paths — ran on the pinned version, not inferred.
Demonstrates the installation of `vsts-npm-auth` globally on Windows, configuring a project-level `.npmrc` file, and running the authentication helper to enable `npm install` from an Azure Artifacts private feed.
For non-Windows environments, use Azure DevOps Personal Access Tokens (PATs) configured directly in `.npmrc`, or consider cross-platform alternatives like `ado-npm-auth` or `azure-devops-npm-auth`.
Microsoft's current documentation for Azure Artifacts npm feeds suggests alternatives. Where possible, migrate to official PAT-based authentication or open-source, community-maintained alternatives such as `ado-npm-auth` or `azure-devops-npm-auth`.
Always run `vsts-npm-auth` with the `-F` (force) flag to ensure tokens are refreshed if they are expired or nearing expiration: `vsts-npm-auth -config .npmrc -F`.
When using `vsts-npm-auth` in CI/CD or other non-interactive contexts, ensure you include the `-N` (NonInteractive) flag: `vsts-npm-auth -config .npmrc -N -F`.
Verify that your npm configuration is pointing to the correct user configuration file location by running `npm config get userconfig`. Ensure `vsts-npm-auth` writes to this expected location, or manually move the generated `.npmrc` content. Consider using a project-level `.npmrc` and pointing to it explicitly with `-config`.
Re-run the authentication command with the force flag: `vsts-npm-auth -config .npmrc -F`. This forces the tool to acquire a new token.
Ensure the registry URL in your `.npmrc` file ends with `/npm/registry/`. If it's correct, re-run `vsts-npm-auth -config .npmrc -F` to refresh the token. For CI, ensure `-N` is used.
Ensure `vsts-npm-auth` is installed globally: `npm install -g vsts-npm-auth`. If it is, check your system's PATH environment variable to ensure the npm global bin directory is included.
When running in CI/CD or other non-interactive contexts, always include the `-N` flag: `vsts-npm-auth -config .npmrc -N -F`. Consider if PATs or other dedicated CI/CD authentication methods are more suitable.
No dependency data recorded yet.