Npm@1 - npm v1 작업

이 작업을 사용하여 npm 패키지를 설치 및 게시하거나 명령을 실행합니다 npm . Azure Artifacts npmjs.com 와 같은 인증된 레지스트리를 지원합니다.

참고

npm 인증 작업은 Azure Artifacts를 사용하여 인증하는 데 권장되는 방법입니다. 이 작업은 더 이상 새로운 기능을 사용하지 않으며 중요한 버그만 해결됩니다.

Syntax

# 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.
# 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.
# 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.

입력

command - 명령
string. 필수 요소. 허용되는 값: ci, , , publish. custominstall 기본값은 install입니다.

실행을 위해 에 전달되는 명령 및 인수를 npm 지정합니다.

인수에 큰따옴표()가 포함된 경우 슬래시("\)로 이스케이프하고 이스케이프된 문자열을 큰따옴표(")로 묶습니다.


command - 명령
string. 필수 요소. 허용되는 값: install, publish, custom. 기본값은 install입니다.

실행을 위해 에 전달되는 명령 및 인수를 npm 지정합니다.

인수에 큰따옴표()가 포함된 경우 슬래시("\)로 이스케이프하고 이스케이프된 문자열을 큰따옴표(")로 묶습니다.


workingDir - package.json 포함하는 작업 폴더
string.

대상 package.json.npmrc 파일을 포함하는 폴더의 경로를 지정합니다. 파일이 아닌 폴더를 선택합니다. 예: /packages/mypackage.


workingDir - package.json 작업 폴더
string.

대상 package.json.npmrc 파일을 포함하는 폴더의 경로를 지정합니다. 파일이 아닌 폴더를 선택합니다. 예: /packages/mypackage.


verbose - 자세한 정보 로깅
boolean. 선택 사항입니다. 을 사용할 때 command = install || command = ci || command = publish사용합니다.

작업이 실행되면 콘솔에 자세한 정보를 출력합니다.


verbose - 자세한 정보 로깅
boolean. 선택 사항입니다. 을 사용할 때 command = install || command = publish사용합니다.

작업이 실행되면 콘솔에 자세한 정보를 출력합니다.


customCommand - 명령 및 인수
string. 필요한 경우 command = custom입니다.

사용자 지정 명령을 실행합니다. 예: dist-tag ls mypackage.


customRegistry - 사용할 레지스트리
string. 선택 사항입니다. 을 사용할 때 command = install || command = ci || command = custom사용합니다. 허용되는 값: useNpmrc (내 .npmrc의 레지스트리), useFeed (여기서 선택한 레지스트리). 기본값은 useNpmrc입니다.

사용할 레지스트리를 지정합니다. .npmrc 소스 코드 리포지토리에 파일을 커밋하고 해당 경로를 값으로 설정하거나 Azure Artifacts의 레지스트리를 값으로 지정합니다.


customRegistry - 사용할 레지스트리
string. 선택 사항입니다. 을 사용할 때 command = install || command = custom사용합니다. 허용되는 값: useNpmrc (내 .npmrc의 레지스트리), useFeed (여기서 선택한 레지스트리). 기본값은 useNpmrc입니다.

사용할 레지스트리를 지정합니다. .npmrc 소스 코드 리포지토리에 파일을 커밋하고 해당 경로를 값으로 설정하거나 Azure Artifacts의 레지스트리를 값으로 지정합니다.


customFeed - 이 Azure Artifacts/TFS 레지스트리의 패키지 사용
string. 필요한 경우 customRegistry = useFeed && command = install || command = ci || command = custom입니다.

생성된 .npmrc에 선택한 피드를 포함합니다. 프로젝트 범위 피드의 경우 또는 ProjectID/FeedID를 사용합니다ProjectName/FeedName. organization 범위 피드의 경우 값은 피드 이름이어야 합니다.


customFeed - 이 Azure Artifacts/TFS 레지스트리의 패키지 사용
string. 필요한 경우 customRegistry = useFeed && command = install || command = custom입니다.

생성된 .npmrc에 선택한 피드를 포함합니다. 프로젝트 범위 피드의 경우 또는 ProjectID/FeedID를 사용합니다ProjectName/FeedName. organization 범위 피드의 경우 값은 피드 이름이어야 합니다.


customEndpoint - 이 organization/컬렉션 외부의 레지스트리에 대한 자격 증명
string. 선택 사항입니다. 을 사용할 때 customRegistry = useNpmrc && command = install || command = ci || command = custom사용합니다.

프로젝트의 에 있는 외부 레지스트리에 사용할 자격 증명입니다 .npmrc. 이 계정/컬렉션의 레지스트리에 대해 이 값을 비워 둡니다. 작업은 빌드의 자격 증명을 자동으로 사용합니다.


customEndpoint - 이 organization/컬렉션 외부의 레지스트리에 대한 자격 증명
string. 선택 사항입니다. 을 사용할 때 customRegistry = useNpmrc && command = install || command = custom사용합니다.

프로젝트의 에 있는 외부 레지스트리에 사용할 자격 증명입니다 .npmrc. 이 계정/컬렉션의 레지스트리에 대해 이 값을 비워 둡니다. 작업은 빌드의 자격 증명을 자동으로 사용합니다.


customEndpoint - 이 계정/컬렉션 외부의 레지스트리에 대한 자격 증명
string. 선택 사항입니다. 을 사용할 때 customRegistry = useNpmrc && command = install || command = custom사용합니다.

프로젝트의 에 있는 외부 레지스트리에 사용할 자격 증명입니다 .npmrc. 이 계정/컬렉션의 레지스트리에 대해 이 값을 비워 둡니다. 작업은 빌드의 자격 증명을 자동으로 사용합니다.


publishRegistry - 레지스트리 위치
string. 선택 사항입니다. 을 사용할 때 command = publish사용합니다. 허용되는 값: useExternalRegistry (외부 npm 레지스트리(다른 계정/컬렉션 포함), useFeed (여기서 선택한 레지스트리). 기본값은 useExternalRegistry입니다.

명령이 대상으로 지정할 레지스트리를 지정합니다.


publishFeed - 대상 레지스트리
string. 필요한 경우 publishRegistry = useFeed && command = publish입니다.

계정에서 호스트되는 레지스트리를 지정합니다. 여기에서 레지스트리를 선택하려면 패키지 관리가 설치되고 라이선스가 있어야 합니다.


publishPackageMetadata - 파이프라인 메타데이터 게시
boolean. 선택 사항입니다. 을 사용할 때 command = publish && publishRegistry = useFeed && command = install || command = ci || command = publish사용합니다. 기본값은 true입니다.

빌드/릴리스 파이프라인의 메타데이터(실행 # 및 소스 코드 정보)를 패키지와 연결합니다.


publishPackageMetadata - 파이프라인 메타데이터 게시
boolean. 선택 사항입니다. 을 사용할 때 command = publish && publishRegistry = useFeed && command = install || command = publish사용합니다. 기본값은 true입니다.

빌드/릴리스 파이프라인의 메타데이터(실행 # 및 소스 코드 정보)를 패키지와 연결합니다.


publishEndpoint - 외부 레지스트리
string. 필요한 경우 publishRegistry = useExternalRegistry && command = publish입니다.

외부 레지스트리에 게시하는 데 사용할 자격 증명을 지정합니다.


작업 제어 옵션

모든 작업에는 작업 입력 외에 제어 옵션이 있습니다. 자세한 내용은 컨트롤 옵션 및 일반적인 작업 속성을 참조하세요.

출력 변수

없음

설명

참고

Azure Pipelines를 사용하여 피드에 패키지를 게시하려면 프로젝트 컬렉션 빌드 서비스 및 프로젝트의 Build Service ID를 기여자로 설정해야 합니다. 자세한 내용은 새 사용자/그룹 추가 를 참조하세요.

npm 명령 및 인수는 어디에서 배울 수 있나요?

예제

요구 사항

요구 사항 Description
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
실행 중 에이전트, DeploymentGroup
요청 자체 호스팅 에이전트에는 이 작업을 사용하는 작업을 실행하기 위한 다음 요구 사항과 일치하는 기능이 있어야 합니다. npm
Capabilities 이 작업은 작업의 후속 작업에 대한 요구를 충족하지 않습니다.
명령 제한 사항 모두
Settable 변수 모두
에이전트 버전 2.115.0 이상
작업 범주 패키지
요구 사항 Description
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
실행 중 에이전트, DeploymentGroup
요청 자체 호스팅 에이전트에는 이 작업을 사용하는 작업을 실행하기 위한 다음 요구 사항과 일치하는 기능이 있어야 합니다. npm
Capabilities 이 작업은 작업의 후속 작업에 대한 요구를 충족하지 않습니다.
명령 제한 사항 모두
Settable 변수 모두
에이전트 버전 1.91.0 이상
작업 범주 패키지