0
votes

I've been trying to init a new react-native project and always run into the same ETIMEDOUT error.

  1. I've run "react-native init AwesomeProject --verbose" on Terminal

  2. Here is my npm-debug.log: https://gist.github.com/danielweinmann/a3a05ec4c253b9ff0016

  3. I've tried setting npm registry to registry.npmjs.org with both http and https on the URL.

  4. I started testing on a Mountain Lion and then upgraded to El Capitan and continued to get the same result

  5. It seems to install all dependencies correctly and successfuly make all afterAdd writes to package.json, but throws the error after an "unlock" verb that's executed after an "about to build".

Here's the last part of my terminal screen:

npm verb afterAdd /Users/danielweinmann/.npm/uglify-js/2.4.24/package/package.json written
npm verb about to build /Users/danielweinmann/projects/AwesomeProject/node_modules/react-native
npm verb unlock done using /Users/danielweinmann/.npm/_locks/react-native-b39cdeb3f4f93e0a.lock for /Users/danielweinmann/projects/AwesomeProject/node_modules/react-native
npm verb stack Error: connect ETIMEDOUT 23.235.46.162:443
npm verb stack     at Object.exports._errnoException (util.js:856:11)
npm verb stack     at exports._exceptionWithHostPort (util.js:879:20)
npm verb stack     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1062:14)
npm verb cwd /Users/danielweinmann/projects/AwesomeProject
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/Cellar/node/5.4.1/bin/node" "/usr/local/bin/npm" "install" "--verbose" "--save" "react-native"
npm ERR! node v5.4.1
npm ERR! npm  v2.14.15
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect

npm ERR! network connect ETIMEDOUT 23.235.46.162: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 verb exit [ 1, true ]
npm verb unbuild node_modules/react-native
npm info preuninstall [email protected]
npm info uninstall [email protected]
npm verb unbuild rmStuff [email protected] from /Users/danielweinmann/projects/AwesomeProject/node_modules
npm verb gentlyRm vacuuming from /Users/danielweinmann/projects/AwesomeProject/node_modules/.bin/react-native up to /Users/danielweinmann/projects/AwesomeProject
npm info postuninstall [email protected]
npm verb gentlyRm don't care about contents; nuking /Users/danielweinmann/projects/AwesomeProject/node_modules/react-native

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/danielweinmann/projects/AwesomeProject/npm-debug.log
`npm install --save react-native` failed

Does anyone know what's happening? Can anyone help me?

Thanks a lot!

2
This is likely a generic NPM connectivity issue (perhaps caused by a proxy or firewall) and not one associated uniquely with React Native. Can you ping registry.npmjs.org? If you type npm view npm version what do you get? - Adam Terlson
Yes, @AdamTerlson, I can ping registry.npmjs.org. My npm version is 2.14.15 and my node version is v5.4.1. I can install a lot of npm packages manually, and all dependencies seem to be installed correctly on the log. I get the same error, at the same point, every time I try it. My console gets stalled when I type npm view npm version, though. Should it work like npm -v? - Daniel Weinmann
Does it really stall? npm view npm version can take a moment for large packages. The command fetches the npm package from npm and displays its package.config version. You can omit the last "version" bit to see what I mean and type just npm view npm. You can also try the command npm view react-native version. - Adam Terlson
Thanks, @AdamTerlson! I Should have googled that before asking, sorry. npm view npm version now returns 3.5.3, and npm view react-native version returns 0.18.0-rc. Still having the same problem, at the same point of the script, though. New executions have an almost exact npm-debug.log as the one I posted above. - Daniel Weinmann
Hmm, well I'm sorry, I just don't know then! It still seems like a possible proxy/network issue. Try from another location, perhaps? - Adam Terlson

2 Answers

1
votes

In the end, it was a network issue, indeed. I solved it by routing my mobile phone's internet connection to my computer through wi-fi.

0
votes

In my case I have to disable firewall on my belkin router. Related to https://github.com/npm/npm/issues/8293 not react-native specific