react-native: react-native init hangs without any error output
After I do react-native init AwesomeProject
,it just hangs at This will walk you through creating a new React Native project in /Users/jarnanchen/repo/AwesomeProject
, with the slash spinning around for more than 20 minutes.
Tried several times and the results are the same.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 69 (4 by maintainers)
if you from China, do this:
Registry has beensetto: http://registry.npm.taobao.org/
very very very … very fast
In China, npm is blocked by gfw causing react-native init hangs.
There are two solutions:
vim
which react-native``echo 'registry = https://registry.npm.taobao.org' > ~/.npmrc
(Recommeded!)Then you can re-run
react-native init AwesomeProject
, it would be much faster. But if you still feel it is slow, tryreact-native init AwesomeProject --verbose
, and you can see what is going on.I was having issue with the command
react-native run-ios
Got it running by just using the
sudo
with the command. 😃 👍I had
react-native
hang for a different reason => watchman . On my Mac, I had to:to clear whatever watchman had leftover, that was making it hang w/o any output. And along with it, it got
react-native
to hang:https://github.com/facebook/react-native/blob/9ee815f6b52e0c2417c04e5a05e1e31df26daed2/packager/react-packager/src/node-haste/FileWatcher/index.js#L20
Maybe this helps anyone. It took me almost one hour to debug this …
probably related: #2797
Hanging after
npm info ok
seems to be caused bywatchman
. Just chiming in here to report the workaround documented in #9943 works.When I run the
init
command, it will hangs after the output below when withoutsudo
.But when I run with
sudo
,it will be successed,don’t konw why. The next output is:Try running it with sudo because the long error log had “[Username] does not have permission…”. It worked in a flash for me.
@deepflame you can try npm3, it will gives you more information
Finally, I got the problem, it will takes you more than one day (connection is slow or you are in China) to clone the whole react repository.
UPDATE : After wait for a long time , the init was successful
The same problem, so I update my npm to version 3, the same problem
in package.json react-tools point to react(don’t know why)
and I don’t know what is
aft
, it is not a npm package