我尝试运行npm install -g polymer-cli
,但每次运行时都会给我一个错误。
NPM正在企业代理后面运行,该代理配置为git和npm。我没有安装bower或gulp的问题,使用git克隆存储库没有问题。
我试过没有结果:
git config --global url."https://".insteadOf git://
来自这里
Stack Overflow - git:// protocol blocked by company, how can I get around that?
这是输出的一部分:
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.
答案 0 :(得分:0)
以admin身份运行命令(打开cmd并以管理员身份运行)或在linux中以sudo身份运行。就我而言,它解决了这个问题。
答案 1 :(得分:0)
确保您的id_rsa
文件位于c:\users\$username\.ssh
配置 ssh-agent 程序以使用SSH密钥:
打开控制台并运行start-ssh-agent
。它会找到您的id_rsa
并提示您输入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)
然后尝试再次运行npm install
。
注意: ssh-agent 也可能已在运行:
start-ssh-agent
Found ssh-agent at 402860
Found ssh-agent socket at /tmp/ssh-YT2trepckpeN/agent.431360
在这种情况下使用ssh-add它会找到你的id_rsa
并提示你输入密码:
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)