Create-react-native-app: react-native-scripts start stuck at "Starting packager..."

Created on 3 Aug 2017  ·  60Comments  ·  Source: expo/create-react-native-app

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 [email protected]
npm ERR! peer dep missing: react@>=15.4.0, required by [email protected]

Environment

  1. Operating system: Ubuntu 16.04

Most helpful comment

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

All 60 comments

Same problem here...

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

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

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

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

Same problem in win7

Same issue in macOS 10.12.5. Use [email protected] temporary fix this problem. See #203

Not working again. [email protected] 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 :)

@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 (

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!

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?

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

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

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 [email protected] requires a peer of react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0 but none was installed.
...
npm WARN [email protected] requires a peer of react@>= 16.0.0 but none was installed.
npm WARN [email protected] requires a peer of react@>=15.4.0 but none was installed.
npm WARN [email protected] requires a peer of react@>=15.3.1 but none was installed.

Attempting to start Expo:

$ npm start

> [email protected] 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.

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

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

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

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

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

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

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.

Solved by connecting to a VPN.

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.

same problem in debian 9,

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!

Tried what @alvaro1728 suggested and still now luck.

Environment is

macOS 10.11.15
Node 8.6.0
NPM 4.6.1

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.

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

brew remove watchman
brew install watchman

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

  • Linux Machine and iphone connected to the same wifi network
  • I have disabled firewall sudo ufw disable
  • I have removed watchman and reinstalled create-react-native-app npm install -g create-react-native-app
  • After i have recreated new application
    create-react-native-app AwesomeProject cd AwesomeProject npm start
  • When Starting Package press q you will see the QR code
  • Scan it and tell us the result

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?

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

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.

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.

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.

thanks for that info @matthiaw!

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

@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

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.

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?

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

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

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 [email protected]
npm info using [email protected]
npm verb run-script [ 'prestart', 'start', 'poststart' ]
npm info lifecycle [email protected]~prestart: [email protected]
npm info lifecycle [email protected]~start: [email protected]

[email protected] 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 [email protected]~start: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~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 [email protected]~start: CWD: /Users/borch/Documents/React_Native/pet-tracker
npm info lifecycle [email protected]~poststart: [email protected]
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.

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

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

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.

The following stackflow suggestion fixed it for me.

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

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...

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!

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

@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.

I am, just tried that and still won't load my javascript bundle. Can I ask what version of watchman you are running?

@AlexB801 4.9.0

Here is my package.json

{
"name": "UdaciFitness",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.14.0",
"jest-expo": "~27.0.0",
"react-test-renderer": "16.3.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "~0.55.2",
"react-navigation": "1.5.11",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"udacifitness-calendar": "^11.0.0"
}
}

Hmmm. Keep getting same error about react-native-scripts in node_modules.

@AlexB801 not sure, as I did not receive that message. Are you using NPM or YARN to start the app? I am successful with npm run ios.

I've tried them all. lol always stops at the javascript bundle load error.

Ive tried everything and still no luck... though it worked using expo XDE

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

Thank you sir, you make my night!

I've tried to reinstall 'exp' by: sudo npm install -g exp on Mac and the problem is solved.

If you did npm audit fix you might have updated your dependencies to latest versions and the problem is that REACT-NATIVE 0.56.* DOESNT WORK WITH EXPO 27. You should use 0.55.* REACT-NATIVE and never run npm audit fix but npm audit to fix manually

This works for me in package.json

"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "~0.55.2",

here is table of compatabilities
image

Even though i've lined up my versions to the table above (row with 0.55.0 react-native), i still get the following error:

Loading dependency graph...jest-haste-map: @providesModule naming collision:
Duplicate module name: crud
Paths: /Users/name/ProjectName/awsmobilejs/backend/cloud-api/itemsHandler/package.json collides with /Users/name/ProjectName/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.

Any idea to resolve this clash?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

WeslleyNasRocha picture WeslleyNasRocha  ·  4Comments

witbybit picture witbybit  ·  4Comments

liyanxi picture liyanxi  ·  3Comments

scf4 picture scf4  ·  5Comments

anp picture anp  ·  3Comments