node.js - 在 Azure DevOps 源上添加其他 npm 包
问题描述
我为我的项目使用 Angular 2.4,并且该项目包含.npmrc
使用内部寄存器的文件。目前构建管道正在返回此错误:
找不到与 yargs@^3.32.0 匹配的版本。在大多数情况下,您或您的依赖项之一正在请求一个不存在的包版本。
我的项目正在使用uglify-js
npm 包,而yargs
npm 包是它的依赖项之一。因此,我在 package.json 中添加了yargs
anduglify-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 匹配的版本。在大多数情况下,您或您的依赖项之一正在请求一个不存在的包版本。
在我的构建管道中,我添加.npmrc
了带有注册 url 的文件,该文件连接到提要。而且在提要中,这个yargs
包不存在。我想知道如何在提要中添加额外的 npm 包?
解决方案
在 Azure DevOps 源上添加其他 npm 包
要解决此问题,您可以将 npmjs.com 添加为供稿的上游源:
请检查文档Use packages from npmjs.com:
- 编辑您的提要。选择页面右上角的齿轮图标以打开提要设置。
- 选择上游源枢轴。
- 在命令栏中选择添加上游源。
- 选择 Select a feed URL 并选择 npmjs.com ( https://registry.npmjs.org )。如果您愿意,可以自定义上游名称。
- 选择添加。
或者,您可以通过以下命令安装包 yargs:
npm install yargs
或者在 github 上克隆这个项目:
git clone http://github.com/bcoe/yargs.git
然后我们可以从命令行发布一个 npm 包。
推荐阅读
- verilog - 在verilog的时序逻辑中会发生锁存吗
- angular6 - 如何在 ngx-admin-starter-kit 中添加新组件及其路由?
- r - splashr - 网页抓取:在 Splashr 中为 splash_click() 找到精确的鼠标坐标
- ios - ios - 从普通 AR 视图切换到耳机 AR 视图
- android - 如何在 Android 中获取私有文件夹的 Uri?
- bash - 如何在git别名中转义上游的花括号@{u}(Windows上的git-bash)?[更新]
- python - gevent中greenlet的足迹是多少?
- apostrophe-cms - 当前页面上的自定义搜索
- javascript - jquery 发布文件表单,但服务器一无所获?
- python - 生成的列表由此代码段中的 [显然] 未计入的空格组成