React-native: [Packager] Cannot read property 'root' of null

Created on 6 Jul 2015  路  62Comments  路  Source: facebook/react-native

Hello,
I tried to update react-native or reinstalled it but no positive effect. This happens right after launching the app.
Does anyone has more info on this ? Thanks

TypeError: Cannot read property 'root' of null
    at /Users/isasportas/Projects/canalplus/iOS/RemoteX1/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
    at tryCallOne (/Users/isasportas/Projects/canalplus/iOS/RemoteX1/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
    at /Users/isasportas/Projects/canalplus/iOS/RemoteX1/node_modules/react-native/node_modules/promise/lib/core.js:103:15
    at flush (/Users/isasportas/Projects/canalplus/iOS/RemoteX1/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
    at process._tickCallback (node.js:355:11)
Locked

Most helpful comment

I've bought a new MacBook Pro and the problem fixed.

All 62 comments

I'm getting the exact same error. I think i solved this one by updating flow and watchman. Now i have issues related to settings modules in react-native. I reverted back to 0.6 for now.

Used to be in React 0.5. No issues on React 0.6

I'm also seeing this on master ("react packager has encountered an internal error" in the app and "Cannot read property 'root' of null" in the packager). I first got this after pulling master last Thursday afternoon. I had to revert to back to 951b5f9 (26 June) so I could keep working.

Ah, good tip @chirag04: updating watchman (brew update and brew upgrade watchman) fixed this issue for me.

Yep upgrading watchman fixed the issue. Thanks. But it would have been too simple to make things work haha, now I'm getting this :

Error: undefined is not an object (evaluating 'RCTSettingsManager.settings')

So the same issue as @chirag04 ... I'm on 0.6 by the way

@ilansas I have the exact same error. Not sure what is the fix here.

This issue is exhibited in master at the current time. I performed a git pull origin master, then npm i.

Looking for JS files in
   /www/ios/react-native.fresh 


React packager ready.

[1:11:43 PM] <START> fs crawl
TypeError: Cannot read property 'root' of null
    at /www/ios/react-native.fresh/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
    at tryCallOne (/www/ios/react-native.fresh/node_modules/promise/lib/core.js:37:12)
    at /www/ios/react-native.fresh/node_modules/promise/lib/core.js:103:15
    at flush (/www/ios/react-native.fresh/node_modules/promise/node_modules/asap/raw.js:50:29)
    at process._tickCallback (node.js:355:11)
[1:11:44 PM] <START> request:/Examples/UIExplorer/UIExplorerApp.ios.includeRequire.runModule.bundle?dev=true

Removing node_modules and doing an npm doesn't fix the issue.

@jaygarcia update your watchman

@chirag04 , that fixed it.

Any way we could get a warning setup somehow?

+1 go this error as well. Resolved it by upgrading watchman as above.

As mentioned previously it'd be nice to know that the watchman version is too old for the specific version of react-native. As an external dependency outside of npm, it'd be great to be able to check that version to show custom error messages to guide the user.

@brentvatne seems like the solution is to upgrade watchman

@malkomalko - good point, can you create an issue or PR for that? Closing this one as upgrading solves it!

same issue, a warning would have been welcomed (i guess pr hasn't been opened yet)

i have some issue, but brew upgrade watchman,it's ok.

In addition to upgrading Watchman, I also had to quit terminal in order to clear the error. Killing the terminal window that Xcode opened should be sufficient.

Chiming in here, I had to upgrade watchman as well. That fixed it for me! It would be nice if the docs mentioned updating brew prior to installing the necessary packages.

@ryanmcdermott "We recommend periodically running brew update && brew upgrade to keep your programs up-to-date." it does, but I guess it doesn't say "do that first"

@browniefed I should always be in the habit of doing that regardless of if I read directions or not!

Same error

@xcatliu run the following commands: "brew update && brew upgrade watchman"

Same error after updating to 0.10.0.

$ brew update
Already up-to-date.
$ brew upgrade watchman
Error: watchman HEAD already installed

Restarted, cache flushed. Temporary change the line to
return fileWatcher.getWatchers().then(([watcher]) => return true)

Getting exactly the same error on a fresh installation.

@gbezyuk Same here. I did brew update && upgrade watchman. error still occurs.

I have a working install from a few days ago which is on 53dc991 and that works. You'll need to checkout and recompile it yourself though.

This didn't work for me, I still get that error:

$ brew update
$ brew upgrade watchman

@alejomendoza - try brew uninstall watchman and brew install watchman -HEAD

perfect, thank you @brentvatne ! that worked. :+1:

brew upgrade watchman -HEAD
Error: watchman 3.7.0 already installed

Still happening

brew uninstall watchman

and

brew install watchman -HEAD

Worked for me .. Before was getting error as I had two versions of watchman installed .

brew update && brew unlink watchman && brew install watchman -HEAD
then closing the terminal and rebuilding the app worked for me.

@ohadpartuck Thanks a lot, it helped.

Works now. Notice you seem to have forgotten a -

I think to make sure run them separately like this because parts of the above command failed for me.

brew update
brew uninstall watchman
brew unlink watchman
brew install watchman --HEAD

Had the same problems here - @cmpis's fix worked for me.

I've bought a new MacBook Pro and the problem fixed.

That's a pretty expensive fix @Xcat. :p

-- cmp

On Sun, Sep 13, 2015 at 10:16 PM, Xcat Liu [email protected]
wrote:

I've bought a new MacBook Pro and the problem fixed.

Reply to this email directly or view it on GitHub:
https://github.com/facebook/react-native/issues/1875#issuecomment-139940914

good job,remember to restart terminal

xcat solution is working fine :+1:

+1 for @cmpis solution

I had same error on fresh start.. after brew update and brew upgrade watchman and restart the terminal.. things started to work..

Would be great if we could have this on the documentation.

So remember to close/open your terminal

Please try the following steps, it is working for me.

$ brew unlink watchman
$ brew install watchman

screen shot 2015-09-18 at 4 46 38 pm

I'm having the same issue on a fresh install on El Capitan (latest beta)

Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
==> Downloading https://homebrew.bintray.com/bottles/watchman-3.7.0.el_capitan.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/watchman-3.7.0.el_capitan.bottle.tar.gz
==> Pouring watchman-3.7.0.el_capitan.bottle.tar.gz

Anyone got this running on El Capitan? I'm using Xcode 7 (final, not the beta)

I've found a solution. My watchman was installed via MacPorts and not via brew.

You can verify it with watchman -v. If it's still 3.1.0 after updating brew it means it's managed by macports.

To get it working on El Capitan, remove macports and install it via brew
sudo rm -rf /opt/local \ /Applications/DarwinPorts \ /Applications/MacPorts \ /Library/LaunchDaemons/org.macports.* \ /Library/Receipts/DarwinPorts*.pkg \ /Library/Receipts/MacPorts*.pkg \ /Library/StartupItems/DarwinPortsStartup \ /Library/Tcl/darwinports1.0 \ /Library/Tcl/macports1.0 \ ~/.macports

You might also brew uninstall pcre && brew install pcre if you're getting errors about get-sockname.

@ohadpartuck it worked, thx a lot

I guess I'm the only one using macports here :-) might as well get rid of that option in the docs and only recommend brew

I found I had to actually uninstall watchman and reinstall it to get the correct El Capitan version. After that it worked

I am still having this issue. Entirely removed watchman, and reinstalled at version 3.8.0.

OSX Yosemite, XCode 7 Beta 5, Node 4.1.1

@GameReplays I had the same issue and ended up checking out a fresh copy of react-native which seemed to resolve the issue (after re-installing watchman etc)

I had a issue " ERROR watchman--no-pretty get-sockname returned with exit code 1 ERROR: Unknown option --no-pretty" on El Capitan 10.11.1 beta. I'm trying fix it but not work :(

@appleboy Was having same issue El Capitan 10.11 Beta (15A279b) fixed by:
brew uninstall watchman
brew install watchman

As others have said, removing and installing watchman worked for me

Had the same problems here - @cmpis's fix worked for me. It takes me a long time to fix it.
Try:
git fetch origin
git reset --hard origin/master
brew update
brew uninstall watchman
brew unlink watchman
brew install watchman --HEAD

$ brew uninstall watchman
$ brew  install watchman --HEAD

works for me. When I use brew upgrade watchman锛宱nly get Error: watchman-HEAD already installed.

I am using El Capitan version and stuck at same error, tried all possible permutation and combination.

same here, El Capitan and running into below errors

Error building DependencyGraph:
 TypeError: Cannot read property 'root' of undefined
    at index.js:16:84
    at tryCallOne (/Users/huang47/Documents/projects/react-native/node_modules/promise/lib/core.js:37:12)
    at /Users/huang47/Documents/projects/react-native/node_modules/promise/lib/core.js:103:15
    at flush (/Users/huang47/Documents/projects/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
    at doNTCallback0 (node.js:417:9)
    at process._tickCallback (node.js:346:13)

Also got

TypeError: Cannot read property 'root' of undefined

but solved it using @norfish solution. thx!

Updating watchman works!!! Thanks

I should have googled first. Wasted a few hours to update various Homebrew packages. Simply "brew upgrade watchman" didn't work for me. But the one mentioned by @norfish worked. Thanks a lot!

brew upgrade watchman, this error is gone!

brew update && brew unlink watchman && brew install watchman -HEAD

this works for me

$ brew update
$ brew upgrade watchman

it's work for me

Was this page helpful?
0 / 5 - 0 ratings