简体   繁体   中英

Cannot Install angular cli

Below is what I get when trying to install angular globally. Not sure why it is trying to install from git...

C:\D\Ts.NetAngular> npm install -g angular/cli info: please complete authentication in your browser...-session 3cdebc65d33fb371 npm ERR: Error while executing: npm ERR. C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh.//git@github.com/angular/cli:git npm ERR. npm ERR. Host key verification failed: npm ERR: fatal: Could not read from remote repository. npm ERR. npm ERR. Please make sure you have the correct access rights npm ERR. and the repository exists. npm ERR! npm ERR! exited with error code: 128 npm ERR! A complete log of this run can be found in: npm ERR! C:\Users...\AppData\Roaming\npm-cache_logs\2020-12-08T23_50_51_414Z-debug.log

And when I open the gitlog file, I see the below...

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\Program Files (x86)\nodejs\node.exe',
1 verbose cli 'C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'angular/cli'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v14.15.1
4 verbose npm-session 0d6fdae54b49f7b5
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for github:angular/cli Error while executing:
7 silly fetchPackageMetaData C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/angular/cli.git
7 silly fetchPackageMetaData
7 silly fetchPackageMetaData Host key verification failed.
7 silly fetchPackageMetaData fatal: Could not read from remote repository.
7 silly fetchPackageMetaData
7 silly fetchPackageMetaData Please make sure you have the correct access rights
7 silly fetchPackageMetaData and the repository exists.
7 silly fetchPackageMetaData
7 silly fetchPackageMetaData exited with error code: 128
8 timing stage:rollbackFailedOptional Completed in 0ms
9 timing stage:runTopLevelLifecycles Completed in 4183ms
10 verbose stack Error: exited with error code: 128
10 verbose stack at ChildProcess. (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\pacote\lib\util\finished.js:12:19)
10 verbose stack at ChildProcess.emit (events.js:315:20)
10 verbose stack at maybeClose (internal/child_process.js:1048:16)
10 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
11 verbose cwd C:\D\TGit\TestGit\POCs\Web\TypescriptWeb\Ts.NetAngular
12 verbose Windows_NT 10.0.15063
13 verbose argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "angular/cli"
14 verbose node v14.15.1
15 verbose npm v6.14.8
16 error Error while executing:
16 error C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/angular/cli.git
16 error
16 error Host key verification failed.
16 error fatal: Could not read from remote repository.
16 error
16 error Please make sure you have the correct access rights
16 error and the repository exists.
16 error
16 error exited with error code: 128
17 verbose exit [ 1, true ]

Any suggestions?

Using following commands to uninstall:

npm uninstall -g @angular/cli

npm cache clean --force

Using following commands to re-install:

npm install -g @angular/cli

I just found a temporary solution... maybe its a permanent one. Can comment. The solution was to open git bash and install the angular from there. Earlier I had tried from Terminal of Visual Studio code and also tried cmd even with elevated privileges. But succeeded only with Git Bash which was already installed. It's is somehow linked with github. It's still not clear why it works. And also not clear why angular/cli depends on github for installation

Try

npm install @angular/cli --legacy-peer-deps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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