Enabling Watchman on Windows causes JS errors
See original GitHub issueRunning 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)
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):
[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:
- Created 7 years ago
- Comments:11 (2 by maintainers)
I get exactly the same errors. Haven’t been able to figure it out yet.
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