On a Ubuntu 17.0.4 box, with yarn version 0.21.3 and create-react-app 1.3 on one laptop where yarn successfully can install from online sources, create-react-app insists on thinking it's offline and won't install. A downgrade to 1.1.0 (before this offline feature was added) fixed this issue.
Can you dig registry.yarnpkg.com (dig/host/ping) and post the output?
If all seems well, can you run this snippet in the node REPL and see what err is?
Output of dig;
koen@koen: ~/code/react$ dig registry.yarnpkg.com
; <<>> DiG 9.10.3-P4-Ubuntu <<>> registry.yarnpkg.com
;; global options: +cmd
;; connection timed out; no servers could be reached
koen@koen: ~/code/react$
output of ping;
koen@koen: ~/code/react$ ping registry.yarnpkg.com
PING registry.yarnpkg.com (104.16.60.173) 56(84) bytes of data.
64 bytes from 104.16.60.173 (104.16.60.173): icmp_seq=1 ttl=60 time=13.1 ms
64 bytes from 104.16.60.173 (104.16.60.173): icmp_seq=2 ttl=60 time=13.6 ms
64 bytes from 104.16.60.173 (104.16.60.173): icmp_seq=3 ttl=60 time=13.1 ms
64 bytes from 104.16.60.173 (104.16.60.173): icmp_seq=4 ttl=60 time=12.2 ms
64 bytes from 104.16.60.173 (104.16.60.173): icmp_seq=5 ttl=60 time=12.8 ms
64 bytes from 104.16.60.173 (104.16.60.173): icmp_seq=6 ttl=60 time=12.8 ms
^C
--- registry.yarnpkg.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5008ms
rtt min/avg/max/mdev = 12.230/12.979/13.681/0.449 ms
koen@koen:~/code/react$
I'll note that other Linux machines on the same local network didn't display this problem. And yarn did work just fine on the machine where create-react-app thought it was online.
Can one of you please test https://github.com/facebookincubator/create-react-app/blob/master/packages/create-react-app/createReactApp.js#L519 and then switch it to lookup after and see if it fixes it?
We tried the following snippet:
const dns = require("dns");
dns.resolve("registry.yarnpkg.com", err => {
console.log("resolve: " + (err === null));
});
dns.lookup("registry.yarnpkg.com", err => {
console.log("lookup: " + (err === null));
});
The output on my (working) machine is:
resolve: true
lookup: true
But on @kdleijer machine with the problem it's:
resolve: false
lookup: true
And do both result int false when offline?
Sounds like he might have a DNS configuration error, but if this is something we can make more reliable, I'm all for it.
Hi Timer
Yes both are false when completely offline with Ubuntu.
For DNS configuration I have;
koen@koen:~/code/react$ cat /etc/resolv.conf
# Generated by NetworkManager
search mydomain.local
nameserver 127.0.1.1
koen@koen:~/code/react$
Sure, happy to switch.
Tried all, with different results;
koen@koen:~/code/react$ ping www.google.com
PING www.google.com (209.85.202.104) 56(84) bytes of data.
64 bytes from dg-in-f104.1e100.net (209.85.202.104): icmp_seq=1 ttl=48 time=26.4 ms
64 bytes from dg-in-f104.1e100.net (209.85.202.104): icmp_seq=2 ttl=48 time=27.7 ms
64 bytes from dg-in-f104.1e100.net (209.85.202.104): icmp_seq=3 ttl=48 time=30.6 ms
64 bytes from dg-in-f104.1e100.net (209.85.202.104): icmp_seq=4 ttl=48 time=26.6 ms
--- www.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 26.402/27.851/30.610/1.690 ms
koen@koen:~/code/react$
------------------------------------------------------------------------------
koen@koen:~/code/react$ host -v www.google.com
Trying "www.google.com"
;; connection timed out; no servers could be reached
koen@koen:~/code/react$
------------------------------------------------------------------------------
koen@koen:~/code/react$ dig @8.8.8.8 www.google.com
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @8.8.8.8 www.google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16443
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.google.com. IN A
;; ANSWER SECTION:
www.google.com. 299 IN A 74.125.143.99
www.google.com. 299 IN A 74.125.143.104
www.google.com. 299 IN A 74.125.143.147
www.google.com. 299 IN A 74.125.143.106
www.google.com. 299 IN A 74.125.143.103
www.google.com. 299 IN A 74.125.143.105
;; Query time: 253 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Mar 16 15:01:58 CET 2017
;; MSG SIZE rcvd: 139
koen@koen:~/code/react$
------------------------------------------------------------------------------
koen@koen:~/code/react$ ifconfig
eno1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 20:47:47:f2:73:ca txqueuelen 1000 (Ethernet)
RX packets 507 bytes 157000 (157.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 425 bytes 104648 (104.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xf7200000-f7220000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 15353 bytes 1737029 (1.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15353 bytes 1737029 (1.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lxcbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.0.3.1 netmask 255.255.255.0 broadcast 0.0.0.0
ether 00:16:3e:00:00:00 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.50.198 netmask 255.255.255.0 broadcast 192.168.50.255
inet6 fe80::de53:60ff:fe38:c836 prefixlen 64 scopeid 0x20<link>
ether dc:53:60:38:c8:36 txqueuelen 1000 (Ethernet)
RX packets 237878 bytes 26784109 (26.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 312287 bytes 39795785 (39.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
koen@koen:~/code/react$
------------------------------------------------------------------------------
koen@koen:~/code/react$ ip route
default via 192.168.50.254 dev wlp2s0 proto static metric 600
10.0.3.0/24 dev lxcbr0 proto kernel scope link src 10.0.3.1 linkdown
169.254.0.0/16 dev wlp2s0 scope link metric 1000
192.168.50.0/24 dev wlp2s0 proto kernel scope link src 192.168.50.198 metric 600
koen@koen:~/code/react$
------------------------------------------------------------------------------
koen@koen:~/code/react$ sudo iptables -n -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:67
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:67
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
koen@koen:~/code/react$
---------------------------------------------------------------------------
koen@koen:~/code/react$ yarn global add [email protected]
yarn global v0.21.3
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
- create-react-app
warning No license field
Done in 4.76s.
----------------------------------------------------------------------------
koen@koen:~/code/react$ create-react-app test3
Creating a new React app in /home/koen/code/react/test3.
Installing packages. This might take a couple minutes.
Installing react, react-dom, and react-scripts...
yarn add v0.21.3
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "[email protected]" has unmet peer dependency "babel-core@^6.0.0".
warning "[email protected]" has unmet peer dependency "webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc".
warning "[email protected]" has unmet peer dependency "babel-eslint@^7.0.0".
warning "[email protected]" has unmet peer dependency "eslint@^3.16.1".
warning "[email protected]" has unmet peer dependency "eslint-plugin-flowtype@^2.21.0".
warning "[email protected]" has unmet peer dependency "eslint-plugin-import@^2.0.1".
warning "[email protected]" has unmet peer dependency "eslint-plugin-jsx-a11y@^2.0.0 || ^3.0.0 || ^4.0.0".
warning "[email protected]" has unmet peer dependency "eslint-plugin-react@^6.4.1".
warning "[email protected]" has unmet peer dependency "eslint@>=1.6.0 <4.0.0".
warning "[email protected]" has unmet peer dependency "webpack@^1.9.11".
warning "[email protected]" has unmet peer dependency "eslint@^2.10.2 || 3.x".
warning "[email protected]" has unmet peer dependency "eslint@>=2.0.0".
warning "[email protected]" has unmet peer dependency "webpack@1 || ^2.1.0-beta".
warning "[email protected]" has unmet peer dependency "eslint@^2.0.0 || ^3.0.0".
warning "[email protected]" has unmet peer dependency "[email protected] - 3.x".
warning "[email protected]" has unmet peer dependency "file-loader@*".
warning "[email protected]" has unmet peer dependency "webpack@>=1.3.0 <3".
warning "[email protected]" has unmet peer dependency "webpack@1 || ^2.1.0-beta || ^2.2.0-rc.0".
warning "[email protected]" has unmet peer dependency "react@^15.4.2".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 742 new dependencies.
鈹溾攢 .........
Done in 9.27s.
Success! Created test3 at /home/koen/code/react/test3
Inside that directory, you can run several commands:
yarn start
Starts the development server.
yarn run build
Bundles the app into static files for production.
yarn test
Starts the test runner.
yarn run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can鈥檛 go back!
We suggest that you begin by typing:
cd test3
yarn start
Happy hacking!
koen@koen:~/code/react$
It might indeed seems like a DNS-issue,a although [email protected] does work
The older create-react-app works because this is a new feature.
Would you like to send a PR switching us to lookup?
I would try adding google's DNS (8.8.8.8 & 8.8.4.4) to your conf file.
@kdleijer is very new at this whole toolchain (in fact I was giving a React training when this happened on his machine) so a PR may be a bridge too far. I could do a PR with him but it'll have to be next week.
Is this just about changing the one line to lookup? It doesn't look like much automatic testing is possible for this change, but we can test whether it fixes the issue for him manually (if we can still replicate his firewall issue).
Yeah, it's just that one line change. 馃槃 You can even edit the file on GitHub.
Okay, we'll see whether @kdleijer wants to do it! We can say it's part of the training. :)
Ok, @kdleijer and I will look at this when we can sit down together Monday. Thanks for the quick and constructive feedback, it's very much appreciated!
No problem, thank you for being responsive!
Most helpful comment
No problem, thank you for being responsive!