angular - 无法使用 npm 安装 Angular cli
问题描述
我已按照此处的文档安装 angular cli
当我在空目录中运行命令时,出现$ npm install -g @angular/cli
以下错误:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for semver@^7.3.5.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of '@npmcli/git'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! ~/.npm/_logs/2021-06-11T14_50_50_128Z-debug.log
然而 semver7.3.5 可以在这里找到
我不明白为什么我会收到这个错误,有人有答案吗?
$ node -v
v14.16.1
$ npm -v
6.14.12
$ cat ~
283 verbose stack semver: No matching version found for semver@^7.3.5.
283 verbose stack at pickManifest (~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:122:13)
283 verbose stack at ~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:24:14
283 verbose stack at tryCatcher (~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
283 verbose stack at Promise._settlePromiseFromHandler (~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:517:31)
283 verbose stack at Promise._settlePromise (~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:574:18)
283 verbose stack at Promise._settlePromiseCtx (~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:611:10)
283 verbose stack at _drainQueueStep (~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:142:12)
283 verbose stack at _drainQueue (~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
283 verbose stack at Async._drainQueues (~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)
283 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (~/node-v14.16.1-linux-x64/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
283 verbose stack at processImmediate (internal/timers.js:461:21)
284 verbose cwd ~/tevc/manufacture-poc/manufacturer-angular
285 verbose Linux 4.4.0-210-generic
286 verbose argv "~/node-v14.16.1-linux-x64/bin/node" "~/node-v14.16.1-linux-x64/bin/npm" "install" "-g" "@angular/cli"
287 verbose node v14.16.1
288 verbose npm v6.14.12
289 error code ETARGET
290 error notarget No matching version found for semver@^7.3.5.
291 error notarget In most cases you or one of your dependencies are requesting
291 error notarget a package version that doesn't exist.
291 error notarget
291 error notarget It was specified as a dependency of '@npmcli/git'
292 verbose exit [ 1, true ]
编辑
我有一个自定义的 npm 注册表
解决方案
我在这里定义了一个自定义注册表~/.npmrc
删除该注册表允许我成功安装 @angular/cli