facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.07k stars 24.19k forks source link

react-native init hangs without any error output #2806

Closed jarnanchen closed 8 years ago

jarnanchen commented 8 years ago

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.

jarnanchen commented 8 years ago

https://github.com/facebook/react-native/issues/2797 Looks like someone has got the same issue like mine

kebot commented 8 years ago

The same problem, so I update my npm to version 3, the same problem

~/Codes/test/node_modules/react-native   242s
❯ cpm install
loadDep:react-tools → aft ▄ ╢█████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟

in package.json react-tools point to react(don't know why)

 "react-tools": "git://github.com/facebook/react.git#b4e74e38e43ac53af8acd62c78c9213be0194245",

and I don't know what is aft, it is not a npm package

jarnanchen commented 8 years ago

UPDATE : After wait for a long time , the init was successful

kebot commented 8 years ago

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.

mkonicek commented 8 years ago

Are you in China? Can you point npm (and Gradle if you're doing Android development) to some mirror of: JS and Obj-C code: https://www.npmjs.com/package/react-native Java code: http://bintray.com/bintray/jcenter

mkonicek commented 8 years ago

Can you please use Stack Overflow to ask questions and tag them with react-native? http://stackoverflow.com/questions/tagged/react-native

This helps us keep track of bugs that need to be fixed in Github issues.

jarnanchen commented 8 years ago

@mkonicek Yes , I am in China. However I did tried several times via VPN connection, not much help though.

deepflame commented 8 years ago

hmm, is it true that is clones the whole repo? I am in Germany and have a 25MBit connection. So it should not be slow. However I am waiting here now for about 10min and I just see the spinnner.

Would be great to have a notice or something that it can take longer otherwise people (like me) think that it is broken.

deepflame commented 8 years ago

still spinning... about 35min now. Going to make another coffee...

kebot commented 8 years ago

@deepflame you can try npm3, it will gives you more information

deepflame commented 8 years ago

Hey @kebot , thanks for your hint. I installed NPM 3 now and it went through!

deepflame commented 8 years ago

well, but I would not advice to install NPM 3 though. Got stuck now with

Could not find dependencies.
Ensure dependencies are installed - run 'npm install' from project root.

Seems to be an issue with NPM 3... https://github.com/facebook/react-native/issues/1758

kebot commented 8 years ago

@deepflame just feel free to remove the detection code in packager/packager.js

deepflame commented 8 years ago

@kebot thanks for your hints. However I installed NPM 2 again and it is working now fine. Will probably copy this newly generated app skeleton then when i want to work on a new one to avoid the problems I had at first. Thanks again and have a nice weekend!

Just tried again. For whatever reason it is working now with NPM 2. Guess it is the npm cache?

uinz commented 8 years ago

about 8 day ago, i init a project about 10 min , but since yesterday i init a project more than 12 hours and it's still not finished, i have to cancel it and go bed. by the way, i am form china, and try to use VPN, however there is popular vocabulary in chian "then be none"(然并卵).

kebot commented 8 years ago

@yinzSE can you post the output here?

uinz commented 8 years ago

@kebot i succeeded after a long time, and before that there is nothing output. i use npm@2.14.6 do not use npm3.x

sudo npm install -g npm@2.14.6

VPN use USA npm source use https://registry.npmjs.org/

u can open Monitor to watch “git" process. if it downloading means u just only wait for some time. and it's will download more then 70M data.

To run your app on iOS: Open /Users/yinz/Desktop/xs/ios/xs.xcodeproj in Xcode Hit Run button To run your app on Android: Have an Android emulator running, or a device connected cd /Users/yinz/Desktop/xs react-native run-android

welkang commented 8 years ago

I found that this dependency must installed under root permission, "react-tools": "git://github.com/facebook/react#b4e74e38e43ac53af8acd62c78c9213be0194245", Maybe this is the reason why it hangs always.

kenit commented 8 years ago

I have the same problem. I live in Taiwan and below is my environment information. nodejs@4.1.2 npm@3.3.5 linux mint@17.2

warpdesign commented 8 years ago

+1 (OSX - El Capitan)

solupro commented 8 years ago

Same problem. From China nodejs@4.1.2 npm@2.14.6 OSX - El Capitan

no-repeat commented 8 years ago

From China +1 How to deal with the problem?

jihopark commented 8 years ago

in HK. so slow... not working for several times

noscripter commented 8 years ago

in china, facing the same problem 2.

could add --verbose for verbose output, from my experience, I was hold up in the process of loadDep:react-tools

reference https://github.com/facebook/react-native/pull/3193

I've tried cnpm, but still hang for a long time waiting for the modules to be installed.

klvs commented 8 years ago

Same issue. npm 2.14.4 node v4.1.2 OSX - Yosemite United States, San Mateo if it matters

uinz commented 8 years ago

open Activity Monitor , make sure git process is downloading. which will download about 70M files.

Patience is very important

gutenye commented 8 years ago

@yinzSE Thanks, that's very helpful.

warpdesign commented 8 years ago

@yinzSE I was patient, but after 20 or 30 minutes, I got this error:

Setting up new React Native app in /Users/leodaed/Dev/ReactSlide fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
          ^

Error: EACCES: permission denied, open '/Users/leodaed/.babel.json'
likeliondj commented 8 years ago

@yinzSE Thank you so much. I solved it with your advice by switching npm version :)

uinz commented 8 years ago

@warpdesign I don't know how to solve that. sorry to let you down

agrawalravi95 commented 8 years ago

Try running it with sudo because the long error log had "[Username] does not have permission...". It worked in a flash for me.

xiaobinlzy commented 8 years ago

@yinzSE It works. Thanks a lot!

gfZeng commented 8 years ago

@yinzSE It works. Thanks a lot!

ddramone commented 8 years ago

Well, it took more than 5 minutes for me before i forced to stop. After that i tried it again with sudo. It took 3 seconds, not more.

wfxiang08 commented 8 years ago

In China, npm is blocked by gfw causing react-native init hangs.

There are two solutions:

  1. modify the react-native script
    • vimwhich react-native``
    • exec('npm install --save react-native'
    • var proc = spawn('npm', ['install', '--verbose', '--save', 'react-native'], {stdio: 'inherit'});
  2. add a new file .npmrc in your home dir
    • 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, try react-native init AwesomeProject --verbose, and you can see what is going on.

wellingfine commented 8 years ago

Same problem to me . I stuck in loadDep:react-tools ▐ ╢██████████████░░░░░░ After read all comments , I wait 2hours ,the progress bar never move. Can I download the files by myself? osx 10.11 node v5.0.0 npm 3.3.6 vpn in USA Sanfrancisco

wellingfine commented 8 years ago

@wfxiang08 after seting the registry now ,still stuck in another position

npm verb afterAdd /Users/wellingfine/.npm/babel-core/5.8.34/package/package.json written loadDep:react-tools ▄ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟

jackyon commented 8 years ago

hm.. I try the above opinions, this issue still existed.

SeanWit commented 8 years ago

wfxiang08 Thanks!

wfxiang08 commented 8 years ago

@wellingfine sorry to hear that. My solution indeed solve my problem effectively. But if the problem still exists, then I don't know what to do~~

jnuhwb commented 8 years ago

Same problem from China. Change npm registry to https://registry.npm.taobao.org solve my problem.

codesundar commented 8 years ago

same problem from India also

Waiting Waiting Waiting for a long time

codesundar commented 8 years ago

Execute react-native init ProjectName --verbose option

springuper commented 8 years ago

+1 for this problem and the stop point doesn't remain stable.

npm verb afterAdd /Users/spring/.npm/babel-core/5.8.34/package/package.json written
loadDep:react-tools       ▄ ╢███████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
davedx commented 8 years ago

Same problem here, I'm in the Netherlands. Internet connection is fine. I use npm all the time for multiple projects, so it's really weird it keeps getting stuck for react-native. What is react-native doing that's different?

d668 commented 8 years ago

U updated brew, reinstalled node and npm and run react-native init with --verbose. It showed me the process and after 20 min finally installed the project. Was weird though at the beginning....

PeterMu commented 8 years ago

@yinzSE It works, thx. I just do this: VPN use USA npm source use https://registry.npmjs.org/

haha...

CryptoZ258 commented 8 years ago

I also use VPN, but nothing changed, I just fail and try agian on the old folder(choose yes when terminal ask continue), and it successd! node v4.2.3 npm v2.14.7 Mac OSX , EI Capitan

captain-miao commented 8 years ago

if you from China, do this:

npm install -g nrm
nrm use taobao

Registry has beensetto: http://registry.npm.taobao.org/

npm install -g react-native-cli --verbose
react-native init AwesomeProject --verbose

very very very ... very fast

d668 commented 8 years ago

no I am using VPN, I am not going to use chinese shit servers for nothing