5

New to react, working through a udemy tutorial on a Mac. Installed node ok but when I go to start a project

react-native init projectname

terminal output:

This will walk you through creating a new React Native project in /Users/myuserid/projects/projectname Installing react-native package from npm...

and it just "hangs" there... seemingly frozen or chugging along. When I check Monitor it looks like Terminal is using 0% CPU. There is no indication (backslash flipping or otherwise) that it is processing.

Inside the projectname directory is a "package.json" file and a "node_modules" file with a bunch of subfiles.

I saw this post with a similar problem (https://github.com/facebook/react-native/issues/2806), but doesn't look like there is a remedy. Is there any way to speed this up? How can I tell if it has stalled forever? Will this happen during every project init I do?

I'm not in China... I have fast internet... and I'm using NPM 3.3.12

Thank you!

Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
sthoward
  • 81
  • 2
  • 13
  • 3
    Try running via `react-native init projectname --verbose` to confirm that something goes wrong. It is usual that the init command takes very long. – purii Jan 09 '16 at 16:30
  • Thanks, @purii. Not sure if the '--verbose' tag jarred something or it was simply the nth time quitting and redoing the command... but now it goes through. Doesn't seem like the --verbose itself should change anything and I'd love to know the real reason, but glad it's working now. Thanks. – sthoward Jan 10 '16 at 18:37
  • FYI - 3 projects in a row now that init stalls unless I use '--verbose'. Seems like something must be amiss but for those looking for a possible solution, this seems to maneuver around whatever short-circuit is happening. – sthoward Jan 11 '16 at 19:27
  • I had the same issue recently and solved it here http://stackoverflow.com/questions/39821692/react-native-init-hanging – Mike Oct 05 '16 at 13:22
  • I am also encountered the same and searched the solution. But after 5 minutes it started initiating the project. – Ganesh Kanna Oct 19 '16 at 07:11

2 Answers2

4

I got the same issue , and i found the 1st comment on the question is useful .

Indeed , If no error, it means that it takes time to download dependencies.

You can track downloading by adding --verbose :

react-native init projectname --verbose

You will spend a long period to reach 50% of downloading.


Nevertheless, you might face the following error :

npm WARN react-native@0.34.0 requires a peer of react@~15.3.1 but none was installed. npm verb exit [ 0, true ]

If so , check this thread .

Community
  • 1
  • 1
Abdennour TOUMI
  • 87,526
  • 38
  • 249
  • 254
0

I had the same problem while using an existing (empty) directory as App name
It worked as soon as I changed the App name to something new

MonoThreaded
  • 11,429
  • 12
  • 71
  • 102