question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enabling Watchman on Windows causes JS errors

See original GitHub issue

Running React Native 0.23.1 (with CLI 0.2.0) on Windows 7 works and the phone successfully loads the JS bundle: (note: no watchman installed)

[5:51:15 PM] <END>   Crawling File System (111063ms)
[5:51:15 PM] <START> Building in-memory fs for JavaScript
[5:51:16 PM] <END>   Building in-memory fs for JavaScript (689ms)
[5:51:16 PM] <START> Building in-memory fs for Assets
[5:51:16 PM] <END>   Building in-memory fs for Assets (520ms)
[5:51:16 PM] <START> Building Haste Map
[5:51:16 PM] <START> Building (deprecated) Asset Map
[5:51:17 PM] <END>   Building (deprecated) Asset Map (138ms)
[5:51:17 PM] <END>   Building Haste Map (630ms)
[5:51:17 PM] <END>   Building Dependency Graph (112912ms)
transformed 522/522 (100%)
[5:51:36 PM] <END>   find dependencies (111802ms)
[5:51:41 PM] <END>   request:/index.android.bundle?platform=android&dev=true&hot
=false&minify=false (116804ms)

untitled

After installing watchman (alpha for Windows 7 x64), the process is faster a few orders of magnitude:

[5:53:54 PM] <END>   Crawling File System (324ms)
[5:53:54 PM] <START> Building in-memory fs for JavaScript
[5:53:54 PM] <END>   Building in-memory fs for JavaScript (0ms)
[5:53:54 PM] <START> Building in-memory fs for Assets
[5:53:54 PM] <END>   Building in-memory fs for Assets (0ms)
[5:53:54 PM] <START> Building Haste Map
[5:53:54 PM] <START> Building (deprecated) Asset Map
[5:53:54 PM] <END>   Building (deprecated) Asset Map (1ms)
[5:53:54 PM] <END>   Building Haste Map (2ms)
[5:53:54 PM] <END>   Building Dependency Graph (333ms)

However, now the packager server returns an error:

{"message":"Cannot find entry file index.android.js in any of the roots: [\"C:\\\\Users\\\\Filip\\\\react\\\\demo\"]","name":"NotFoundError","type":"NotFoundError","status":404,"errors":[{}]}

Deleting the index file and pasting it again randomly fixes the issue. However, the Android app now throws an error:

ReferenceError: Can't find variable: __fbBatchedBridge(<unknown file>:1)

You’d think that it is similar to #4881 and #4952 and the issue is the packer not running, but it actually is and the device can access it (correct ip:port in settings, tcp communication happens):

untitled

[5:58:09 PM] <END>   request:/index.android.bundle?platform=android&dev=true&hot
=false&minify=false (1578ms)

In addition the request returns valid babelified code that resembles the index.android.js source code (both when requested from the computer and the phone browser):

(function(global) {global.
__DEV__=true;

global.__BUNDLE_START_TIME__=Date.now();
})(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this);
(function(global) {var 
modules=Object.create(null);
var inGuard=false;

function define(id,factory){
modules[id]={
factory:factory,
module:{exports:{}},
isInitialized:false,
hasError:false};


if(__DEV__){
babelHelpers.extends(modules[id].module,{
hot:{

...........

Note: There is difference in source code size:

  • GET index.android.bundle?minify=false without watchman: 250KB
  • GET index.android.bundle?minify=false with watchman: 24KB

I am suspecting that the watchman ignores dependencies and generates a bundle which does not contain all the required code (including some dep __fbBatchedBridge)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ghostcommented, May 12, 2016

I get exactly the same errors. Haven’t been able to figure it out yet.

3reactions
janicduplessiscommented, Apr 19, 2016

I’ve had success using watchman alpha on windows, not sure exactly what causes this but like you said the package is way too small.

Maybe you can try resetting everything with

rm -rf node_modules
watchman watch-del-all
npm install
npm start -- --reset-cache
Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting | Watchman - Meta Open Source
A recrawl is an action that Watchman performs in order to recover from situations where it believes that it has lost sync with...
Read more >
React Native `npm start` with watchman error - Stack Overflow
Now when I enter npm start I get [sane] Warning: Lost connection to watchman, reconnecting.. . Any suggestions? Update: This started happening ...
Read more >
Troubleshooting - Jest
Troubleshooting. Uh oh, something went wrong? Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why​.
Read more >
Setting up a working environment on MacOS - JavaScript Camp
To work, you need the following components: Node, Watchman, XCode, and the React ... Node.js & Watchman & CocoaPods​ ... A window with...
Read more >
Newest 'watchman' Questions - Stack Overflow
I am getting this error when I try to run gulp serve on a webpart that I generated through SPFx. I am on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found