expo / create-react-native-app

Create React Native apps that run on iOS, Android, and web
BSD 3-Clause "New" or "Revised" License
13.26k stars 1.35k forks source link

react-native-scripts start stuck at "Starting packager..." #343

Closed ATF19 closed 6 years ago

ATF19 commented 7 years ago

Description

I can't start any CRNA project because it get stuck at "Starting packager", i tried many project but the problem still remains. It always get stuck at "Starting packager..."

Expected Behavior

It should start the project and show me the expo QR code

Observed Behavior

Stuck at "Starting packager..."

Note

npm shows me an unmet dependency error with expo and react: npm ERR! peer dep missing: react@>=15.3.1, required by lottie-react-native@1.1.1 npm ERR! peer dep missing: react@>=15.4.0, required by react-native-branch@2.0.0-beta.3

Environment

  1. Operating system: Ubuntu 16.04
devin6391 commented 7 years ago

Same problem here...

RohanNg commented 7 years ago

I have the same problems with fresh CRNA project. I am using Ubuntu 16.04.

aizuddineismail commented 7 years ago

Hey guys. I faced the same problem and this solved the problem for me. I hope it will solve your problem too.

Ok. It was fixed by runnig sudo sysctl -w fs.inotify.max_user_watches=10000 before “npm start”

I found it in Expo forums.

Reference : https://forums.expo.io/t/packager-not-loading-on-linux/2034

ATF19 commented 7 years ago

Fixed by running sudo sysctl -w fs.inotify.max_user_watches=10000

brentvatne commented 7 years ago

@fson - we should warn better in the situations wheter the fix that @ATF19 mentioned is required (suggest either that or watchman)

iversong commented 7 years ago

Same problem in win7

0x5e commented 7 years ago

Same issue in macOS 10.12.5. Use react-native-scripts@0.0.26 temporary fix this problem. See #203

0x5e commented 7 years ago

Not working again. react-native-scripts@0.0.26 doesn't help. Network problem? I setup the proxy in shell then packager start quickly. I have tried many times, almost 100% success with proxy, and 100% stuck without proxy. Chinese people please have a try :)

limichange commented 7 years ago

@0x5e , Thank you so much. You are right. It's a network problem. I can run it with proxy, and stuck without proxy. Maybe almost chinese people can't run it now, so sad (

0x5e commented 7 years ago

Hi @brentvatne, what does the network request used for? I'm new in node.js and can't find where the request started from. Could you please set a timeout or make this request async? We really need this for the poor network situation, thanks!

nimir commented 7 years ago

Facing issues with the npm star stuck with no error. Started from #234 and learned to increase my inotify watchers but the problem still come from time to time. So as @limichange and @0x5e i concluded it's a network related issue!

A quick look at the packager scripts no requests appear there! and even with DEBUG=* and --verbose nothing useful is logged! So tried running iftop to monitor requests and i see many of them to aws, cloudfront, ...etc which seems to be fired somewhere from the packager dependencies (expo probably). As of other users from China we share the same issue requiring proxy connection for these hosts and being based in Africa, we have a bad connection!

I really loved the convenience this package brings to RN development experience and it would be great to be able to develop offline and only request internet connection if/when user wants to publish to expo or something!

Please let me know if there might be another cause to this and how can i help resolving it?

aigdonia commented 7 years ago

same problem here, still nothing solving this even the suggested inotify solution

WoeOm commented 7 years ago

Installed two watchman? Delete npm install , keep brew @aigdonia

nathan-osman commented 7 years ago

I'm seeing this problem as well.

Host: Ubuntu 17.04 64-bit Node: 8.4.0 NPM: 4.6.1 create-react-native-app: 1.0.0

Creating the project:

$ create-react-native-app myapp
...
npm WARN react-redux@5.0.6 requires a peer of react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0 but none was installed.
...
npm WARN react-native-gesture-handler@1.0.0-alpha.17 requires a peer of react@>= 16.0.0 but none was installed.
npm WARN react-native-branch@2.0.0-beta.3 requires a peer of react@>=15.4.0 but none was installed.
npm WARN lottie-react-native@1.1.1 requires a peer of react@>=15.3.1 but none was installed.

Attempting to start Expo:

$ npm start

> myapp@0.1.0 start path/to/myapp
> react-native-scripts start

11:59:53: Starting packager...

...and nothing happens after that. No QR code. Nothing.

I tried running:

$ sudo sysctl -w fs.inotify.max_user_instances=1024
fs.inotify.max_user_instances = 1024
$ sudo sysctl -w fs.inotify.max_user_watches=12288
fs.inotify.max_user_watches = 12288

...and installing watchman. Neither made any difference.

SoeRatch commented 7 years ago

I am facing the same problem . I tried everything that is mentioned above and still it is hanging there in terminal with starting packager .

nathan-osman commented 7 years ago

This only seems to affect Linux - I can run npm start on Win10 without any problems.

IvRRimum commented 7 years ago

@nathan-osman Have the same problem on a mac sierra

toma21207 commented 7 years ago

Also here. I am facing the same problem. Ubuntu 16.04. Tried all from above and it didn't help.

arefed-zz commented 7 years ago

@nathan-osman I have this problem on Windows 10!

KeonPaul commented 7 years ago

@arefed Same problem on windows 10 as well it was working a recently though

cideM commented 7 years ago

I ran the sysctl commands on Ubuntu 17.04, but to no avail. What did work however was removing node_modules and then installing all packages with yarn instead of npm through yarn install. I had previously run npm install out of sheer habit.

MicroDroid commented 7 years ago

Solved by connecting to a VPN.

giang-nghg commented 7 years ago

I have 2 machines: Both run Ubuntu 16.04, same nodejs, yarn, create-react-native-app version, but one use SSD and one doesn't. The one without SSD does not have this problem. The one with SSD needs a very big fs.inotify.max_user_watches (mine was 10000000)

Hopefully this info can be helpful in finding the root cause somehow.

marcosguti commented 7 years ago

same problem in debian 9,

alvaro1728 commented 7 years ago

I don't know what solved it for me but here are the steps I took:

  1. brew update && brew update watchman
  2. rm -rf node_modules && npm cache clean && npm i
    • I got the same npm warnings about the react version.
  3. npm start

This gave me the QR code!

stephenhandley commented 7 years ago

Tried what @alvaro1728 suggested and still now luck.

Environment is

macOS 10.11.15
Node 8.6.0
NPM 4.6.1
stephenhandley commented 7 years ago

When running DEBUG=* npm start I saw two error messages, one about watchman not being 0.4.6 (homebrew stable is 0.4.5) and the other about the app manifest expo not matching the version in package.json. I uninstalled watchman and updated the app.json and seeing the QR code now.

ir4y commented 7 years ago

I got the same issue after upgrade to high sierra. I resolved the issue by reinstalling watchman

brew remove watchman
brew install watchman
stoufa06 commented 7 years ago

I got same issues with many more others. I am using linux mint OS:

jean commented 7 years ago

npm start failed with a link to https://github.com/react-community/create-react-native-app/issues/234 I installed watchman and that got me to a hanging "Starting packager..." line. I then ran the sysctl command to increase fs.inotify.max_user_watches, and that worked.

Can watching everything be toggled off by default?

dhruvdutt commented 7 years ago

Try

echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

If it's still stuck, then install watchman from here and do this

watchman watch-del-all && watchman shutdown-server
Inlesco commented 7 years ago

thanks a ton, @dhruvdutt

even if you've installed watchman with brew, watchman watch-del-all && watchman shutdown-server (it should be supposed to, right?) in the root dir still works and solved the infamous "Starting packager..." freeze issue.

the trick was watchman shutdown-server here. watchman watch-del-all only was never enough in my case.

Eldelshell commented 6 years ago

Had the same problem just starting with create-react-native-app today on Ubuntu 17.10 and finally got it working on Linux.

First of all:

Environment:
  OS: Linux 4.13
  Node: 8.9.1
  Yarn: 1.3.2
  npm: 5.5.1
  Watchman: 4.9.0
  Xcode: N/A
  Android Studio: Not Found

Packages: (wanted => installed)
  react: 16.0.0-beta.5 => 16.0.0-beta.5
  react-native: ^0.49.5 => 0.49.5

Install watchman as explained here

For a fresh Ubuntu install you'll need the following dependencies to build Watchman:

$ sudo apt-get install python-dev libssl-dev autoconf automake libtool

Not sure why python-dev and libssl-dev are not mentioned, but you'll need them to build it.

Follow the instructions for Build from Source.

Next, this:

$ echo fs.inotify.max_user_instances=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
$ echo fs.inotify.max_queued_events=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

And finally, you can run yarn start and it should work.

matthiaw commented 6 years ago

Hi All, on my Ubuntu-System the Packager always stucks and the react-native-app not start fully.

The hint to add the parameters fs.inotify.... to sysctl not worked at all, in no way for me.

I tried other different things under Ubuntu 17.10, but the only thing what worked was the manual compilation and installation from watchman (see https://facebook.github.io/watchman/docs/install.html):

sudo apt-get install -y autoconf automake build-essential python-dev git clone https://github.com/facebook/watchman.git cd watchman git checkout v4.9.0 # the latest stable release ./autogen.sh ./configure make sudo make install

Then use

sudo npm update in the project

and

sudo npm start

This worked for me.

brentvatne commented 6 years ago

thanks for that info @matthiaw!

vko-online commented 6 years ago

My problem was that i opened multiple safari tabs, music player, bunch of terminals, apps (Skype, telegram, etc) and my silly mac was slow and started packager after 4min

RomeoMo commented 6 years ago

@alvaro1728 Thank you SO MUCH! It works for me!

But maybe the first step is "brew update & brew upgrade watchman"

Environment is

macOS High Sierra v10.13.3 node: v8.9.4 npm: 5.6.0

somonek commented 6 years ago

it happened to me and it was the debugger tab in the browser, the websocket got stuck or something. Just closed the tab, restarted the app with a fresh debugging tab and all worked fine.

mohammad7t commented 6 years ago

This is output of sysctl -a | grep fs.inotify

fs.inotify.max_queued_events = 5242880
fs.inotify.max_user_instances = 5242880
fs.inotify.max_user_watches = 5242880

Also when I run watchman --version I get 4.9.0. I have just created react-native-app using create-react-native-app version 1.0.0 I have tried watchman watch-del-all && watchman shutdown-server But none of them solved my problem exactly as stated in https://github.com/react-community/create-react-native-app/issues/343#issue-247660885. How can I debug it?

givia commented 6 years ago

I added 127.0.2.1 exp.host to /etc/host as a workaround.

creative-inquiry commented 6 years ago

I'm on Windows 10. Turning off the windows firewall allowed it to proceed past "PM: Starting packager"

borch84 commented 6 years ago

Hi I am getting the same problem. I created a test app, I was able to work with it using Expo, but now when I run npm start it gets stuck at "Starting Packager..." react-native info returns this:

Environment: OS: macOS High Sierra 10.13.5 Node: 8.11.3 Yarn: 1.7.0 npm: 6.1.0 Watchman: 4.9.4 Xcode: Not Found Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed) react: 16.0.0-alpha.12 => 16.0.0-alpha.12 react-native: ^0.55.4 => 0.55.4

When I run npm start --verbose I got this output:

sudo npm start --verbose npm info it worked if it ends with ok npm verb cli [ '/usr/local/bin/node', npm verb cli '/usr/local/bin/npm', npm verb cli 'start', npm verb cli '--verbose' ] npm info using npm@6.1.0 npm info using node@v8.11.3 npm verb run-script [ 'prestart', 'start', 'poststart' ] npm info lifecycle aws-mobile-react-native-sample@0.1.0~prestart: aws-mobile-react-native-sample@0.1.0 npm info lifecycle aws-mobile-react-native-sample@0.1.0~start: aws-mobile-react-native-sample@0.1.0

aws-mobile-react-native-sample@0.1.0 start /Users/borch/Documents/React_Native/pet-tracker react-native-scripts start

22:24:25: Starting packager... ERROR STARTING PACKAGER No issue with doctor-watchman-version No issue with doctor-problem-checking-watchman-version No issue with doctor-both-app-and-exp-json No issue with doctor-schema-validation No issue with doctor-validate-asset-fields No issue with doctor-schema-validation-exception No issue with doctor-unversioned No issue with doctor-versions-endpoint-failed No issue with doctor-invalid-sdk-version No issue with doctor-node-modules-missing No issue with doctor-react-native-not-installed Starting Metro Bundler on port 19001. Metro Bundler ready.

jest-haste-map: @providesModule naming collision: Duplicate module name: crud Paths: /Users/borch/Documents/React_Native/pet-tracker/awsmobilejs/backend/cloud-api/itemsHandler/package.json collides with /Users/borch/Documents/React_Native/pet-tracker/awsmobilejs/#current-backend-info/cloud-api/itemsHandler/package.json

This warning is caused by a @providesModule declaration with the same name across two different files. 22:28:52: Stopping packager... 22:28:52: Packager stopped. npm verb lifecycle aws-mobile-react-native-sample@0.1.0~start: unsafe-perm in lifecycle true npm verb lifecycle aws-mobile-react-native-sample@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/borch/Documents/React_Native/pet-tracker/node_modules/.bin:/Users/borch/Documents/platform-tools:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin:/usr/local/cuda/bin:/Users/borch/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/borch/bin:/Users/borch/Documents/Robotica/esp/xtensa-esp32-elf/bin npm verb lifecycle aws-mobile-react-native-sample@0.1.0~start: CWD: /Users/borch/Documents/React_Native/pet-tracker npm info lifecycle aws-mobile-react-native-sample@0.1.0~poststart: aws-mobile-react-native-sample@0.1.0 npm verb exit [ 0, true ] npm timing npm Completed in 267308ms npm info ok

From the previous output it says: ERROR STARTING PACKAGER but I can't find what else to look in order to discover the real cause.

I have already increase file number:

sysctl -a | grep kern.maxfiles kern.maxfiles: 5242880 kern.maxfilesperproc: 524288

I updated watchman to 4.9.4.

Haniver commented 6 years ago

When it says "Starting packager...", press the "q" key.

moahmed123 commented 6 years ago

When it says "Starting packager..." press the "q" key. To show QR code

AlexB801 commented 6 years ago

Getting the same as @borch84 above. Using MacOS High Seirra 10.13.6. Also tried other options above with no success. App was working before running 'npm install' and 'npm audit fix' for some dependency issues.

jessequinn commented 6 years ago

The following stackflow suggestion fixed it for me.

https://stackoverflow.com/questions/50724521/react-native-stuck-starting-packager

AlexB801 commented 6 years ago

After following @jessequinn suggestion, able to open simulator, but now won't load Javascript bundle due to error in node_modules. Also noticed before my ios simulator was iPhoneX, now it's iPhone6...

jessequinn commented 6 years ago

yah not working for me either now. This has something to do with watchman maybe? I just created a new app and it does not function!

AlexB801 commented 6 years ago

I'm thinking it's watchman as well. Not sure of a work-around though.

jessequinn commented 6 years ago

@AlexB801 are you using react-navigation? In my case, moving to version 1.5.11 fixed the problem. My app now loads in the emulator. I was work with v2 originally.