Error while installing bower package - node.js

while trying to do bower install on node.js command promt im getting the following error
bower check-new Checking for new versions of the project dependencies..
bower ECMDERR Failed to execute "git ls-remote --tags --heads git#github.com:XXXXX/XXXX", exit
Additional error details:
ssh: connect to host github.com port 22: Bad file number
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Can some one please help me ?
Note: i'm on a corporate network.

This issue might be caused because of your corporate network, they might have blocked some ports.
Try using https instead of ssh
This is how to change:
git config --global url."https://".insteadOf git://

Well i know it kind of late but this did the trick for me.
Open .bowerrc file and set the proxy configuration.
"proxy":"http://xx.xx.xx.xx:8080",
"https-proxy":"http://xx.xx.xx.xx:8080"
and then do a run bower install command
Hope it helps !

Related

How to solve npm install react-select failure with error : An unknown git error occurred, git#github.com :Permission denied (publickey)

I am facing issues to install react-select for my react app, I tried below commands :
npm config set registry http://registry.npmjs.org
npm install --save react-select
I am getting below error:
An unknown git error occurred
git --no-replace-objects ls-remote ssh://git#github.com/eligrey/FileSaver.js.git
git#github.com :Permission denied (publickey)
fatal: Could not read from remote repository
Please make sure you have the correct access rights and
the repository exists
The currently installed versions in my system are node (v16.17.0), npm (8.19.2), react (18.2.0)
How can I resolve this problem?
Thanks
Since https://github.com/eligrey/FileSaver.js is accessible, it is a public repository.
All you need to do is make sure ssh -Tv github.com is working, meaning it gives you a welcome message ("Hi username! You've successfully authenticated...")
Make sure your SSH key is created and registered to your GitHub profile, then try again your npm command.

npm gets stuck on fetchMetadata -> network

My npm is getting stuck a lot, whether its npm install from package.json or individual packages.
Right now, I'm not even able to sudo npm install node-inspector -g
I'm using node 6.2.1, npm 3.9.5 on ubuntu 16.04
npm cache clear didn't help.
The installation takes hours or fails.
Check if there any issues with proxies if you using any.
You can try also to set npm's endpoint manually:
npm config set registry="http://registry.npmjs.org"
try yarn installer instead of npm:
sudo npm install -g yarn
yarn install
I found it much more resilient to such problems.
You'll need to clear your https proxy settings:
npm config rm proxy
npm config rm https-proxy
I had this same problem, with several different installs hanging on fetchMetaData, including the install of yarn mentioned above. I am on a Mac and solved it by updating npm as follows:
npm install npm#latest -g
So if you are encountering this issue on Mac, then try updating and see if it solves your problem.
Did you configured a proxy? See if this returns something:
npm config get https-proxy
npm config get proxy
If you have values configured there, they might not match correct ones. If you shouldn't be using a proxy, you can delete them:
npm config delete https-proxy
npm config delete proxy
Docs: https://docs.npmjs.com/cli/config
For me it was double temp directories in Windows.
Open a command prompt and type:
echo %TEMP%
You should receive path to a single directory. If you receive multiple directories (I received C:\Users\\AppData\Local\Temp;C:\xampp\php) this might be the problem. You can fix it using this command:
SET TEMP="<correct path to temporary directory>"
where <correct path to temporary directory> might be the first path (before semicolon, that means C:\Users\<user>\AppData\Local\Temp in my case).
There are a lot of different things that can cause this issue.
I had tried a lot of things, including most of the answers posted here, but no luck.
For some weird reason, this was my ISP's issue. It worked fine when I tried on a different ISP.
I got the same issue. First of all try to run npm install with -verbose flag. That can help you identify your problem.
That command told me that I had some problem with tunneling socket:
tunneling socket could not be established, cause=write EPROTO 101057795:error:140770FC:SSL routines:SSL 23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:
After that I googled the error and found thread on github about that problem. The problem was in proxy: previously I set up HTTP_PROXY environment variable and after removing then environment variable npm install completed without any error.
I had a similar issue to #giridhar but it wasn't related to the proxy, just that my ssh key wasn't setup properly.
When trying to do a git ls-remote from an ssh:// url. I was getting the prompt to enter my passphrase for my ssh key.
I had to run these commands on command line in order to stop getting asked for my pass phrase:
$ eval `ssh-agent -s`
$ ssh-add ~/.ssh/id_rsa
Once you enter your pass phrase, then you don't have to enter it again anymore.
I highly recommend reading this wiki from Atlassian if you need to setup an ssh key: https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html
For the major chunk of the people, the issue could be related to proxy settings and can be solved by the above-mentioned solutions.
For me, the issue was something else. I have private repository dependencies which are hosted at Bitbucket and are resolved through "git+ssh://git#bitbucket.org/" which intern uses SSH to retrieve the repo.
SSH by default prefers IPv6 if DNS retrieves AAAA record and if the host has one. Since Bitbucket does have AAAA record, SSH is done over IPv6. But my ISP doesn't support IPv6 (You could check if your ISP support's IPv6 by taking a test in http://ipv6-test.com/).
To solve this, you could force SSH client to use IPv4 instead of IPv6.
Set AddressFamily inet in /etc/ssh/ssh_config and restart SSH client.
On Ubuntu to restart SSH client use sudo service ssh restart
Having same problem. Fixed it by switching to correct version of node required by the project.
My project needed node >=v4.3 and <=v5.
1) Check node version being used by nvm ls
2) Use nvm use [version] or else install the specific version. if you don't have.

Git auth failing when running npm install as sudo

I am trying to install an npm package that pulls from our private repo. When I run npm install as myself, I get Please try running this command again as root/Administrator. When I run it as sudo, I get
npm ERR! Error: Command failed: Permission denied (publickey).
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.
I normally don't use sudo to do npm install. I think the issue is that when I run as sudo, it is looking in /var/root/.ssh for the key. I don't have the root user credentials, otherwise I would create a new key as root. Is there another work around?
EDIT: tried the suggestions below, they didn't work. However, the repo in questions is referenced by a dependency below the package root. `./node_modules//package.json. If I change the git url to use http, it works, but it's not a good idea to do it this way because I'll have to change it when I check the package back into the repo.
Try this:
sudo /bin/bash then, run your npm command
I think the issue is that when I run as sudo, it is looking in /var/root/.ssh for the key. I don't have the root user credentials
A workaround would be to change the url of that repo to an http one: it would then query for your login/password instead of relying on ssh keys which you cannot provide as root.
cd /path/to/private/repo
git remote set-url origin https://server/user/repo
If I change the git url to use http, it works, but it's not a good idea to do it this way because I'll have to change it when I check the package back into the repo.
Actually, you can change an url by another without modifying the config of the remote url.
For instance (as in How to use SSH instead of HTTP for Git submodules?)
git config url.https://github.com/.insteadOf ssh://git#github.com/
# or
git config url.https://github.com/.insteadOf git#github.com:

while installing the npm I'm getting the below error

While installing the npm I'm getting the error like below. Please help me. Thanks in Advance.
It seems you does not have installed git in your window pc
so Download the git first from link http://git-scm.com/download/win
then install it and try
npm install
again any error related to permission then try to open your cmd as Run As Admin
You need to have git installed and directly accessible via git command (be on the PATH).

Git on Windows: fatal: Could not read from remote repository

I'm trying to use Git on Windows by using this command on prompt
git ls-remote --tags --heads git://github.com/jquery/jquery.git
And I'm receiving this error:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I was following this tutorial on Web and I'm wondering what is happening (firewall or anything else).
I'm noob with git so any help will be greatly appreciated.
my corporate firewall has blocked the git protocol.
I change git to use https protocol, so it works.
git config --global url."https://".insteadOf git://

Resources