【问题标题】:Add Additional npm packages on Azure DevOps Feed在 Azure DevOps 源上添加其他 npm 包
【发布时间】:2021-09-21 06:03:54
【问题描述】:

我的项目使用 Angular 2.4,并且该项目包含使用内部寄存器的 .npmrc 文件。目前构建管道正在返回此错误:

找不到与 yargs@^3.32.0 匹配的版本。在大多数情况下,您或一个 您的依赖项请求的软件包版本不 存在。

我的项目正在使用uglify-js npm 包,yargs npm 包是它的依赖项之一。因此,我在 package.json 中添加了 yargsuglify-js 以查看它是否会使 Azure DevOp 构建中的错误消失,但事实并非如此。

这是 package.json:

{
  "name": "xxx",
  "version": "1.5.3",
  "private": true,
  "dependencies": {
    "@angular/common": "~2.4.0",
    "@angular/compiler": "~2.4.0",
    "@angular/core": "~2.4.0",
    "@angular/forms": "~2.4.0",
    "@angular/http": "~2.4.0",
    "@angular/platform-browser": "~2.4.0",
    "@angular/platform-browser-dynamic": "~2.4.0",
    "@angular/router": "~3.4.0",
    "@microsoft/1ds-analytics-web-js": "^3.1.6",
    "@microsoft/1ds-properties-js": "^3.1.6",
    "aspnet-webpack": "^1.0.29",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "moment": "2.17.*",
    "ng2-translate": "~5.0.0",
    "ngx-infinite-scroll": "~0.8.2",
    "reflect-metadata": "^0.1.8",
    "rxjs": "~5.5.6",
    "webpack-hot-middleware": "^2.18.0",
    "zone.js": "^0.7.4"
  },
  "devDependencies": {
    "css-loader": "^0.23.1",
    "del": "^2.2.2",
    "extendify": "^1.0.0",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.8.5",
    "gulp": "^3.9.1",
    "jquery": "^2.2.3",
    "raw-loader": "^0.5.1",
    "style-loader": "^0.13.1",
    "ts-loader": "5.4.5",
    "tslint": "^3.8.1",
    "typescript": "4.2.4",
    "url-loader": "^0.5.7",
    "webpack": "^1.13.0",
    "yargs": "^3.32.0",
    "uglify-js": "^2.8.28"
  }
}

但是,我在构建管道中遇到了这个错误:

找不到与 yargs@^3.32.0 匹配的版本。在大多数情况下,您或一个 您的依赖项请求的软件包版本不 存在。

在我的构建管道中,我添加了带有注册 url 的 .npmrc 文件,该文件连接到提要。而在提要中,这个yargs 包不存在。我想知道如何在提要中添加额外的 npm 包?

【问题讨论】:

    标签: node.js angular npm azure-devops .npmrc


    【解决方案1】:

    在 Azure DevOps 源上添加其他 npm 包

    要解决此问题,您可以将 npmjs.com 添加为供稿的上游来源:

    请查看文档Use packages from npmjs.com:

    1. 编辑您的提要。选择页面右上角的齿轮图标 打开 Feed 设置。
    2. 选择上游源枢轴。
    3. 在命令栏中选择添加上游源。
    4. 选择选择一个提要 URL 并选择 npmjs.com (https://registry.npmjs.org)。如果你喜欢,自定义上游 名字。
    5. 选择添加。

    或者,您可以通过以下命令安装包 yargs:

    npm install yargs
    

    或者在github上克隆这个项目:

    git clone http://github.com/bcoe/yargs.git
    

    那我们可以Publish an npm package from the command line

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多