dmotz/natal

npm i failure

mfikes opened this issue · 2 comments

I had npm i fail when running natal init FutureApp:

$ natal init FutureApp
Creating FutureApp

Creating Leiningen project
Updating Leiningen project
Compiling ClojureScript
Creating React Native skeleton
Command failed: npm i

Not sure if anything can actually be done (perhaps at best failure could result in advising the user to take a look at native/npm-debug.log.

FWIW, here is the trailing end of that log for me for when it failed:

2610 verbose afterAdd /Users/fikesm/.npm/babel-core/5.8.33/package/package.json not in flight; writing
2611 verbose afterAdd /Users/fikesm/.npm/babel-core/5.8.33/package/package.json written
2612 error git clone --template=/Users/fikesm/.npm/_git-remotes/_templates --mirror git://github.com/facebook/react.git /Users/fikesm/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b: Cloning into bare repository '/Users/fikesm/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b'...
2612 error git clone --template=/Users/fikesm/.npm/_git-remotes/_templates --mirror git://github.com/facebook/react.git /Users/fikesm/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b: fatal: unable to connect to github.com:
2612 error git clone --template=/Users/fikesm/.npm/_git-remotes/_templates --mirror git://github.com/facebook/react.git /Users/fikesm/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b: github.com[0: 192.30.252.131]: errno=Operation timed out
2613 verbose about to build /Users/fikesm/Desktop/future-app/native/node_modules/react-native
2614 verbose unlock done using /Users/fikesm/.npm/_locks/react-native-ad13db20dbae72a3.lock for /Users/fikesm/Desktop/future-app/native/node_modules/react-native
2615 verbose stack Error: Command failed: git clone --template=/Users/fikesm/.npm/_git-remotes/_templates --mirror git://github.com/facebook/react.git /Users/fikesm/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b
2615 verbose stack Cloning into bare repository '/Users/fikesm/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b'...
2615 verbose stack fatal: unable to connect to github.com:
2615 verbose stack github.com[0: 192.30.252.131]: errno=Operation timed out
2615 verbose stack
2615 verbose stack
2615 verbose stack     at ChildProcess.exithandler (child_process.js:203:12)
2615 verbose stack     at emitTwo (events.js:87:13)
2615 verbose stack     at ChildProcess.emit (events.js:172:7)
2615 verbose stack     at maybeClose (internal/child_process.js:818:16)
2615 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
2616 verbose cwd /Users/fikesm/Desktop/future-app/native
2617 error Darwin 14.5.0
2618 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "i"
2619 error node v4.2.1
2620 error npm  v2.14.7
2621 error code 128
2622 error Command failed: git clone --template=/Users/fikesm/.npm/_git-remotes/_templates --mirror git://github.com/facebook/react.git /Users/fikesm/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b
2622 error Cloning into bare repository '/Users/fikesm/.npm/_git-remotes/git-github-com-facebook-react-git-baa2986b'...
2622 error fatal: unable to connect to github.com:
2622 error github.com[0: 192.30.252.131]: errno=Operation timed out
2623 error If you need help, you may report this error at:
2623 error     <https://github.com/npm/npm/issues>
2624 verbose exit [ 1, true ]
2625 verbose unbuild node_modules/react-native
2626 info preuninstall react-native@0.13.0
2627 info uninstall react-native@0.13.0
2628 verbose unbuild rmStuff react-native@0.13.0 from /Users/fikesm/Desktop/future-app/native/node_modules
2629 silly gentlyRm /Users/fikesm/Desktop/future-app/native/node_modules/.bin/react-native-start is being gently removed
2630 silly gentlyRm verifying /Users/fikesm/Desktop/future-app/native is an npm working directory
2631 silly gentlyRm containing path /Users/fikesm/Desktop/future-app/native is under npm's control, in /Users/fikesm/Desktop/future-app/native
2632 silly gentlyRm deletion target /Users/fikesm/Desktop/future-app/native/node_modules/.bin/react-native-start is under /Users/fikesm/Desktop/future-app/native
2633 verbose gentlyRm vacuuming from /Users/fikesm/Desktop/future-app/native/node_modules/.bin/react-native-start up to /Users/fikesm/Desktop/future-app/native
2634 info postuninstall react-native@0.13.0
2635 silly gentlyRm /Users/fikesm/Desktop/future-app/native/node_modules/react-native is being purged from base /Users/fikesm/Desktop/future-app/native
2636 verbose gentlyRm don't care about contents; nuking /Users/fikesm/Desktop/future-app/native/node_modules/react-native
2637 silly vacuum-fs purging /Users/fikesm/Desktop/future-app/native/node_modules/react-native
2638 silly vacuum-fs removing /Users/fikesm/Desktop/future-app/native/node_modules
2639 silly vacuum-fs finished vacuuming up to /Users/fikesm/Desktop/future-app/native
dmotz commented

Looks like a timeout happened when cloning the React repo.

Have you seen this often?

I can look into prompting the user to check the npm log or to just try again.

@dmotz Yes, it is reproducible for the particular corporate network environment I was in. The root cause is likely something preventing connectivity. So, in this case the best that can be done is to give the end-user some guidance on where to look for the error.