NPM repository

更新时间:
复制 MD 格式

Flow is automatically integrated with the Packages NPM repository. When you run a Node.js build in Flow and use the npm install command, Flow first attempts to download dependency files from your Packages NPM repository. Additionally, Packages automatically proxies the Taobao NPM mirror. This lets you download public dependency files with no extra configuration. Because the NPM mirror is a third-party public service, Alibaba Cloud DevOps does not guarantee its stability.

Important
  • You can only use the npm install command to download dependency files from Packages.

  • cnpm install downloads resources directly from the Taobao NPM mirror. It cannot download your organization's private dependency files from Packages.

If you need to download private dependency files during a build, use one of the following methods:

  • Upload the required dependency files directly to Packages. For instructions, see the repository guide.

  • If you already have a private repository, add it to Packages as a proxy repository. The private NPM repository must be publicly accessible. You may need to add the egress IP addresses of the Flow build cluster to your IP allowlist. In the New Proxy Repository dialog box, enter the repository name (required, 30 characters max) and repository URL (required). Optionally, enter your username and password, and then click Create.

  • If you have a private NPM repository and want Flow to download dependency files directly from it during a build, you can create a custom .npmrc file and place it in your repository root. Follow these steps to generate the .npmrc file:

    • Run the command npm config set registry YOUR_REGISTRY_URL, where YOUR_REGISTRY_URL is the URL of your private NPM repository.

    • Run the command npm adduser. When prompted, enter a valid username and password for your private NPM repository.

    • Locate the ~/.npmrc file and move it to your repository root.