2

I tried running npm install -g polymer-cli but it is giving me an error every time I run it.

NPM is running behind corporate proxy which is configured both for git and npm. I had no problems installing bower or gulp and I have no problem using git to clone repositories.

I have tried this with no result: git config --global url."https://".insteadOf git:// from here Stack Overflow - git:// protocol blocked by company, how can I get around that?

This is part of the output:

31725 error Windows_NT 6.1.7601
31726 error argv "C:\\Users\\user\Documents\\Tools\\node-v6.3.1-win-x64\\node.exe" "C:\\Users\\user\\Documents\\Tools\\node-v6.3.1-win-x64\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "polymer-cli"
31727 error node v6.3.1
31728 error npm  v3.10.5
31729 error code 128
31730 error Command failed: git -c core.longpaths=true clone --template=C:\Users\userAppData\Roaming\npm-cache\_git-remotes\_templates --mirror git@github.com:polymerelements/test-fixture.git C:\Users\user\AppData\Roaming\npm-cache\_git-remotes\git-github-com-polymerelements-test-fixture-git-8142662e
31730 error ssh: connect to host github.com port 22: Bad file number
31730 error fatal: Could not read from remote repository.
31730 error
31730 error Please make sure you have the correct access rights
31730 error and the repository exists.
Community
  • 1
  • 1
jpiechowka
  • 75
  • 1
  • 12
  • I had this error when using quotes for the package name: `npm install -g '@angular/cli'` instead of `npm install -g @angular/cli` – jmbmage Apr 03 '18 at 17:36

2 Answers2

0

Run the command as admin(open cmd and run as admin) or in linux as sudo. In my case, it solves the problem.

Lav Vishwakarma
  • 1,380
  • 14
  • 22
0

Make sure your id_rsa file is in the folder c:\users\$username\.ssh

Configure the ssh-agent program to use your SSH key:
Open the console and run start-ssh-agent. It will find your id_rsa and prompt you for the passphrase:

start-ssh-agent
Removing old ssh-agent sockets
Starting ssh-agent:  done
Enter passphrase for /c/Users/youruser/.ssh/id_rsa:
Identity added: /c/Users/youruser/.ssh/id_rsa (/c/Users/youruser/.ssh/id_rsa)

Then try to run npm install again.


Note: It's also might be possible that the ssh-agent is already running:

start-ssh-agent
Found ssh-agent at 402860
Found ssh-agent socket at /tmp/ssh-YT2trepckpeN/agent.431360

In this case use ssh-add It will find your id_rsa and prompt you for the passphrase:

ssh-add
Enter passphrase for /c/Users/youruser/.ssh/id_rsa:
Identity added: /c/Users/youruser/.ssh/id_rsa (/c/Users/youruser/.ssh/id_rsa)
am0wa
  • 7,724
  • 3
  • 38
  • 33