react-native init AwesomeProject unable to connect to github.com - react-native

I followed the tutorial posted by facebook. Getting startted https://facebook.github.io/react-native/docs/getting-started.html#content
however, when I run react-native init AwesomeProject, I only get the following errors. My node.js is v4.1.0, npm is v2.14.3.
I don't know if my environment is ok or it just can not connect to github.com?
npm ERR! git clone --template=/Users/jansenli/.npm/_git-remotes/_templates --mirror git://github.com/facebook/react.git /Users/jansenli/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b: fatal: unable to connect to github.com:
npm ERR! git clone --template=/Users/jansenli/.npm/_git-remotes/_templates --mirror git://github.com/facebook/react.git /Users/jansenli/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b: github.com[0: 192.30.252.129]: errno=Operation timed out
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/jansenli/.nvm/versions/node/v4.1.0/bin/node" "/Users/jansenli/.nvm/versions/node/v4.1.0/bin/npm" "install" "--save" "react-native"
npm ERR! node v4.1.0
npm ERR! npm v2.14.3
npm ERR! code 128
npm ERR! Command failed: git clone --template=/Users/jansenli/.npm/_git-remotes/_templates --mirror git://github.com/facebook/react.git /Users/jansenli/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b
npm ERR! Cloning into bare repository '/Users/jansenli/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b'...
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 192.30.252.129]: errno=Operation timed out
npm ERR!
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jansenli/AwesomeProject/npm-debug.log
npm install --save react-native failed

First - check if you can actually see github website at all. Just go to https://github.com/facebook/react and you should see the react project. If you can see, that's already good :).
The error messages indicate however that you have problem with downloading the repo via git://github.com/facebook/:react.git. You can validate that by running:
git clone git://github.com/facebook/react.git
It should hang and you should get timeout as well.
If you cannot connect with git:// and if at the same time you can connect to github via https - my wild guess is that you have firewall blocking git protocol via port 9418 connections to github (more about the git protocol here: https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#The-Git-Protocol). You get timeout, which is pretty standard behaviour if you are behind company firewall.
If that's the case, then there are few options. First - bypass the firewall - like do it from home or something ... If you cannot do it however, then you can try to let git always use https:// instead of git://. Apparently those two commands will configure git in this way (I have not tried it, but it should work):
git config --global url."https://github.com/".insteadOf git#github.com:
git config --global url."https://".insteadOf git://
Likely only the first command should be enough (but I am not 100% sure if it is).

Related

npm install takes forever, says I am behind a proxy

I am trying to install different packages using npm 8.19.2. For example yarn
sudo npm install --global yarn
All I get is
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/yarn failed, reason: connect ETIMEDOUT 2606:4700::6810:1823:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-12-08T20_14_13_653Z-debug-0.log
I have a fresh installation of Ubuntu 22.04. According to this: http://www.amibehindaproxy.com/ I am not behind a proxy. I do not understand why I should be either. In fact, I don't know what it is.
node --version
v18.12.1
My goal is to get started with react. First step is to just run npx create-react-app my-app. But that does not work.
wget was also slow, then I found this Slow wget speeds when connecting to https pages.
Updating the network settings and disabling IPv6 did the trick.

Failed to install puppeteer using npm - connect EACCES

When I try to run a npm install, it fails at a dependency called puppeteer.
And if I run:
npm install -g puppeteer#1.5.0
(existing in package.json as "puppeteer": "1.5.0",) it fails with the following error:
npm ERR! code EACCES
npm ERR! errno EACCES
npm ERR! FetchError: request to http://registry.npmjs.org/puppeteer failed, reason: connect EACCES 104.16.27.35:80
npm ERR! at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
npm ERR! at ClientRequest.emit (events.js:182:13)
npm ERR! at Socket.socketErrorListener (_http_client.js:391:9)
npm ERR! at Socket.emit (events.js:182:13)
npm ERR! at emitErrorNT (internal/streams/destroy.js:82:8)
npm ERR! at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
npm ERR! at process._tickCallback (internal/process/next_tick.js:63:19)
but I can access that URL (http://registry.npmjs.org/puppeteer) using my browser.
The other dependencies specified in package.json work fine. Only this one generates problems.
Details:
npm - 6.2.0
node - v10.9.0
OS: Windows
Any suggestions?
npm ERR! code EACCES
npm ERR! errno EACCES
This is a permission error, on a normal day, I will say you should just use sudo npm install -g puppeteer#1.5.0, but I will suggest you reclaim ownership of the .npm directory by running this:
sudo chown -R $(whoami) ~/.npm
Then you need the write permission in node_modules directory:
sudo chown -R $(whoami) /usr/lib/node_modules
after which you can run your npm install -g puppeteer#1.5.0, This should solve your issue.
UPDATE:
I will suggest two other options for you,
from your terminal, run this:
npm config set unsafe-perm=true
OR
use yarn add for your installation.
also sometimes it just takes a while; I used npm install (I'm trying to use formkit but I'm not sure if it matters) --verbose and I'm getting a bunch of
npm http fetch GET 200 https://registry.npmjs.org/#formkit%2fvalidation
70085ms (cache stale)
so I assume its some issue that requires me to download things that take a very long time. Maybe an issue connecting to the verification server?
Edit: restarted computer, cleared cache, etc etc. Still weird and slow.
Not sure what happened but fixed it by going into my IDE (Jetbrains WebStorm) and changing my package handler in settings to a different nodejs. The one I was using was in Program Files and was having trouble accessing pieces in AppData/Roaming, There was another installation inside AppData and picking that one automatically solved my permissions issue.

How to add public bitbucket repo in package.json or bower.json

I have a library pushed on bitbucket as public repo. I want its link to used in package.json dependencies object. I have tried various https formats but not one is working.
"library_name": "https://username#bitbucket.org/repo_name.git"
"library_name": bitbucket://bitbucket.com/username/repo_name.git
"library_name": "bitbucket#bitbucket.com:username/repo_name.git#master
Or I can add it in bower.json? I don't want to use it directly like npm install repo_url
The error I get is something like
ECMDERR Failed to execute "git ls-remote --tags --heads https://username#bitbucket.org/dv.keystone.git", exit code of #128 remote: Not Found fatal: unable to access 'https://username#bitbucket.org/reponame.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
remote: Not Found
fatal: unable to access 'https://username#bitbucket.org/repo_name.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
Update:
"lib_name": "https://username#bitbucket.org/team_name/repo_name.git"
It works in bower.json but I need this in package.json to work. If I use it in package.json, it gives this error
npm ERR! addLocal Could not install /tmp/npm-16628-b0121d64/git-cache-cbc9eb1e/7c4c6a5fb3e77723f3866c99fdf0825ba7cc0c5c
npm ERR! Linux 4.13.0-39-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.12.3
npm ERR! npm v3.10.10
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read
npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.
Did some googling for you - as I wasn't sure myself.
This may work for you:
git+https://bitbucket.org/{user}/{repo}.git
I do not know how to add BitBucket modules in package.json. The way I do add github repo as,
"library-name": "git+https://github.com/user/library-name.git"
So to think about just replacing the github part it should be
"library-name": "git+https://bitbucket.org/user/library-name.git"

How to install mfpdev-cli to offline environment?

I am trying to setup offline (does not have internet access) OS X machine for MobileFirst Platform 8.0 development, and failing to install MobileFirst CLI.
I am referring to this article.
I have installed 8.0.0.0-MFPF-DevKit-MacOSX-IF2016080923.zip on the offline machine, then run.sh and console.sh.
Development server has successfully launched, and now I can access to Operations Console.
I have downloaded mfpdev-cli.tar from the Console, and followed the article I cited above.
Copy mfpdev-cli.tar to online machine.
On the online machine, npm --cache ./.cache install mfpdev-cli.tar
Archive .cache directory, and copy the archive file to the offline machine.
On the offline machine, unarchive .cache directory.
sudo npm install --cache ./.cache ./mfpdev-cli.tar -g
Then, I got below:
npm ERR! fetch failed https://registry.npmjs.org/http-proxy/-/http-proxy-1.13.2.tgz
npm WARN retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
Those ERR! and WARN repeats for many other packages.
And at last:
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--cache" "./.cache" "./mfpdev-cli.tar" "-g"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! Please include the following file with any support request:
npm ERR! /Users/babatch/Downloads/mfpdev-cli/npm-debug.log
How do I install mfpdev-cli on offline machine?
The problem is that npm is attempting to contact its online repository still due to some file dependency on the http-proxy package.
What you can do is to get/add this dependency independently and then try again.
I have tried some methods, and finally it got working.
The procedure is below:
On the online machine, npm install ./mfpdev-cli.tar (without -g)
cd node_modules
tar -cvzf mfpdev-cli.tgz mfpdev-cli and copy mfpdev-cli.tgz just created to the offline machine.
On the offline machine, tar -xvzf mfpdev-cli.tgz
sudo cp -r mfpdev-cli /usr/local/lib/node_modules
cd /usr/local/bin
sudo ln -s ../lib/node_modules/mfpdev-cli/bin/cli.js ./mfpdev
At present, it seems to be working fine.

Stencil CLI Installation Hiccup

Ran into a small hiccup when attempting to install the stencil CLI on my machine running Ubuntu 14.04. I will attach the contents of the error below. At this point, I've been able to verify that npm, and node are installed correctly and I've been able to verify that I have the correct GitHub permissions by confirming my ability to access https://github.com/bigcommerce-stencil/stencil-cli. Any insight would be appreciated.
dante#Ubuntu:~$ sudo npm install -g bigcommerce-stencil/stencil-cli
[sudo] password for dante:
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli Cloning into bare repository '/home/dante/.npm/_git-remotes/git-github-com-bigcommerce-stencil-stencil-cli-12bc62b4'...
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli Warning: Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli Permission denied (publickey).
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli fatal: Could not read from remote repository.
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli Please make sure you have the correct access rights
npm ERR! git clone git#github.com:bigcommerce-stencil/stencil-cli and the repository exists.
npm ERR! addLocal Could not install bigcommerce-stencil/stencil-cli
npm ERR! Error: ENOENT, stat 'bigcommerce-stencil/stencil-cli'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-#googlegroups.com
npm ERR! System Linux 3.16.0-57-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "bigcommerce-stencil/stencil-cli"
npm ERR! cwd /home/dante
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path bigcommerce-stencil/stencil-cli
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/dante/npm-debug.log
npm ERR! not ok code 0
I might also add that I've verified that npm is also installed on my machine as it is bundled w/ the node installation. I feel as if this is something that I'm easily overlooking.
This is due to the closed source code. You need to go through the early access dev flow and add your SSH keys, etc. Should resolve it.