Use this task to install and publish npm packages or to run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
Note
The npm Authenticate task is the recommended way to authenticate with Azure Artifacts. This task no longer takes new features and only critical bugs are addressed.
Syntax
YAML
# npm v1# Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.- task:Npm@1 inputs: command:'install'# 'ci' | 'install' | 'publish' | 'custom'. Required. Command. Default: install.#workingDir: # string. Working folder that contains package.json. #customCommand: # string. Required when command = custom. Command and arguments. # Advanced#verbose: # boolean. Optional. Use when command = install || command = ci || command = publish. Verbose logging. #publishPackageMetadata: true # boolean. Optional. Use when command = publish && publishRegistry = useFeed && command = install || command = ci || command = publish. Publish pipeline metadata. Default: true.# Custom registries and authentication#customRegistry: 'useNpmrc' # 'useNpmrc' | 'useFeed'. Optional. Use when command = install || command = ci || command = custom. Registries to use. Default: useNpmrc.#customFeed: # string. Required when customRegistry = useFeed && command = install || command = ci || command = custom. Use packages from this Azure Artifacts/TFS registry. #customEndpoint: # string. Optional. Use when customRegistry = useNpmrc && command = install || command = ci || command = custom. Credentials for registries outside this organization/collection. # Destination registry and authentication#publishRegistry: 'useExternalRegistry' # 'useExternalRegistry' | 'useFeed'. Optional. Use when command = publish. Registry location. Default: useExternalRegistry.#publishFeed: # string. Required when publishRegistry = useFeed && command = publish. Target registry. #publishEndpoint: # string. Required when publishRegistry = useExternalRegistry && command = publish. External Registry.
YAML
# npm v1# Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.- task:Npm@1 inputs: command:'install'# 'install' | 'publish' | 'custom'. Required. Command. Default: install.#workingDir: # string. Working folder that contains package.json. #customCommand: # string. Required when command = custom. Command and arguments. # Advanced#verbose: # boolean. Optional. Use when command = install || command = publish. Verbose logging. #publishPackageMetadata: true # boolean. Optional. Use when command = publish && publishRegistry = useFeed && command = install || command = publish. Publish pipeline metadata. Default: true.# Custom registries and authentication#customRegistry: 'useNpmrc' # 'useNpmrc' | 'useFeed'. Optional. Use when command = install || command = custom. Registries to use. Default: useNpmrc.#customFeed: # string. Required when customRegistry = useFeed && command = install || command = custom. Use packages from this Azure Artifacts/TFS registry. #customEndpoint: # string. Optional. Use when customRegistry = useNpmrc && command = install || command = custom. Credentials for registries outside this organization/collection. # Destination registry and authentication#publishRegistry: 'useExternalRegistry' # 'useExternalRegistry' | 'useFeed'. Optional. Use when command = publish. Registry location. Default: useExternalRegistry.#publishFeed: # string. Required when publishRegistry = useFeed && command = publish. Target registry. #publishEndpoint: # string. Required when publishRegistry = useExternalRegistry && command = publish. External Registry.
YAML
# npm v1# Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management.- task:Npm@1 inputs: command:'install'# 'install' | 'publish' | 'custom'. Required. Command. Default: install.#workingDir: # string. Working folder with package.json. #customCommand: # string. Required when command = custom. Command and arguments. # Advanced#verbose: # boolean. Optional. Use when command = install || command = publish. Verbose logging. # Custom registries and authentication#customRegistry: 'useNpmrc' # 'useNpmrc' | 'useFeed'. Optional. Use when command = install || command = custom. Registries to use. Default: useNpmrc.#customFeed: # string. Required when customRegistry = useFeed && command = install || command = custom. Use packages from this Azure Artifacts/TFS registry. #customEndpoint: # string. Optional. Use when customRegistry = useNpmrc && command = install || command = custom. Credentials for registries outside this account/collection. # Destination registry and authentication#publishRegistry: 'useExternalRegistry' # 'useExternalRegistry' | 'useFeed'. Optional. Use when command = publish. Registry location. Default: useExternalRegistry.#publishFeed: # string. Required when publishRegistry = useFeed && command = publish. Target registry. #publishEndpoint: # string. Required when publishRegistry = useExternalRegistry && command = publish. External Registry.
Specifies the command and arguments, which are passed to npm for execution.
If your arguments contain double quotes ("), escape them with a slash (\), and surround the escaped string with double quotes (").
workingDir - Working folder that contains package.json string.
Specifies the path to the folder containing the target package.json and .npmrc files. Select the folder, not the file. Example: /packages/mypackage.
workingDir - Working folder with package.json string.
Specifies the path to the folder containing the target package.json and .npmrc files. Select the folder, not the file. Example: /packages/mypackage.
verbose - Verbose logging boolean. Optional. Use when command = install || command = ci || command = publish.
Prints more information to the console when the task runs.
verbose - Verbose logging boolean. Optional. Use when command = install || command = publish.
Prints more information to the console when the task runs.
customCommand - Command and arguments string. Required when command = custom.
Runs a custom command. Example: dist-tag ls mypackage.
customRegistry - Registries to use string. Optional. Use when command = install || command = ci || command = custom. Allowed values: useNpmrc (Registries in my .npmrc), useFeed (Registry I select here). Default value: useNpmrc.
Specifies the registries to use. Commit a .npmrc file to your source code repository and set its path as the value, or specify a registry from Azure Artifacts as the value.
customRegistry - Registries to use string. Optional. Use when command = install || command = custom. Allowed values: useNpmrc (Registries in my .npmrc), useFeed (Registry I select here). Default value: useNpmrc.
Specifies the registries to use. Commit a .npmrc file to your source code repository and set its path as the value, or specify a registry from Azure Artifacts as the value.
customFeed - Use packages from this Azure Artifacts/TFS registry string. Required when customRegistry = useFeed && command = install || command = ci || command = custom.
Includes the selected feed in the generated .npmrc. For project-scoped feeds, use ProjectName/FeedName or ProjectID/FeedID. For organization-scoped feeds, the value should be the feed name.
customFeed - Use packages from this Azure Artifacts/TFS registry string. Required when customRegistry = useFeed && command = install || command = custom.
Includes the selected feed in the generated .npmrc. For project-scoped feeds, use ProjectName/FeedName or ProjectID/FeedID. For organization-scoped feeds, the value should be the feed name.
customEndpoint - Credentials for registries outside this organization/collection string. Optional. Use when customRegistry = useNpmrc && command = install || command = ci || command = custom.
Credentials to use for external registries located in the project's .npmrc. Leave this blank for registries in this account/collection; the task uses the build's credentials automatically.
customEndpoint - Credentials for registries outside this organization/collection string. Optional. Use when customRegistry = useNpmrc && command = install || command = custom.
Credentials to use for external registries located in the project's .npmrc. Leave this blank for registries in this account/collection; the task uses the build's credentials automatically.
customEndpoint - Credentials for registries outside this account/collection string. Optional. Use when customRegistry = useNpmrc && command = install || command = custom.
Credentials to use for external registries located in the project's .npmrc. Leave this blank for registries in this account/collection; the task uses the build's credentials automatically.
publishRegistry - Registry location string. Optional. Use when command = publish. Allowed values: useExternalRegistry (External npm registry (including other accounts/collections)), useFeed (Registry I select here). Default value: useExternalRegistry.
Specifies the registry that the command will target.
The Project Collection Build Service and your project's Build Service identity must be set to Contributor to publish your packages to a feed using Azure Pipelines. See Add new users/groups for more details.
შემოუერთდით Meetup სერიას, რათა შექმნათ მასშტაბური AI გადაწყვეტილებები რეალურ სამყაროში გამოყენების შემთხვევებზე დაყრდნობით თანამემამულე დეველოპერებთან და ექსპერტებთან.