简体   繁体   English

无法使用 npm 安装 angular cli

[英]Cannot install angular cli with npm

I have followed the documentation here to install angualar cli我已按照此处的文档安装 angular cli

When I run the command in an empty directory $ npm install -g @angular/cli I got the following error:当我在空目录$ 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

However semver7.3.5 can be found here然而 semver7.3.5 可以在这里找到

I don't understand why I get this error, does someone have the answer?我不明白为什么我会收到这个错误,有人有答案吗?

$ 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 ]

EDIT编辑

I have a custom npm registry我有一个自定义 npm 注册表

I had a custom registry defined here ~/.npmrc我在这里定义了一个自定义注册表~/.npmrc

Removing that registry allowed me to install @angular/cli successfully删除该注册表允许我成功安装 @angular/cli

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM