Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling Watchman on Windows causes JS errors #7022

Closed
fikisipi opened this issue Apr 17, 2016 · 11 comments
Closed

Enabling Watchman on Windows causes JS errors #7022

fikisipi opened this issue Apr 17, 2016 · 11 comments
Labels
Platform: Windows Building on Windows. Resolution: Locked This issue was locked by the bot.

Comments

@fikisipi
Copy link

fikisipi commented Apr 17, 2016

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)

@fikisipi fikisipi changed the title Watchman on Windows causes random errors Enabling Watchman on Windows causes JS errors Apr 17, 2016
@janicduplessis
Copy link
Contributor

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

@fikisipi
Copy link
Author

fikisipi commented Apr 19, 2016

Does not help, I've tried reinstalling watchman, deleting the watch data, reinstalling the RN stack and deleting the node_modules. I've also tried over 10 watchman executable builds from different versions. It's weird because disabling watchman magically fixes the problem (although the builds become ~1min long)

My temporary solution is to run the packager in a Linux VM while the android build happens in Windows itself. And I guess the docs should suggest that too (considering the buggy performance of RN on Windows)

@ghost
Copy link

ghost commented May 12, 2016

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

@fikisipi
Copy link
Author

fikisipi commented Jun 27, 2016

It's still an issue. In addition, using the latest RN and RN CLI:

[12:17:10 PM] <START> Crawling File System
[Hot Module Replacement] Server listening on /hot

React packager ready.

 ERROR  write EPIPE
{"code":"EPIPE","errno":"EPIPE","syscall":"write"}
Error: write EPIPE
    at exports._errnoException (util.js:870:11)
    at Socket._writeGeneric (net.js:681:26)
    at Socket._write (net.js:700:8)
    at doWrite (_stream_writable.js:301:12)
    at writeOrBuffer (_stream_writable.js:287:5)
    at Socket.Writable.write (_stream_writable.js:215:11)
    at Socket.write (net.js:626:40)
    at Client.sendNextCommand (C:\Users\Filip\basked\node_modules\react-native\n
ode_modules\sane\node_modules\fb-watchman\index.js:48:15)
    at Client.command (C:\Users\Filip\basked\node_modules\react-native\node_modu
les\sane\node_modules\fb-watchman\index.js:235:8)
    at onCapability (C:\Users\Filip\basked\node_modules\react-native\node_module
s\sane\src\watchman_watcher.js:83:19)

This only happens when using watchman alpha, it does not happen if you uninstall it.

@senthilsivanath
Copy link

senthilsivanath commented Jul 2, 2016

Same issue !

With Postman getting this error

{"message":"Cannot find entry file index.android.js in any of the roots: ["D:\Instore\react-native\SampleProject"]","name":"NotFoundError","type":"NotFoundError","status":404,"errors":[{}]}

Have tried all possible workarounds

  1. Like clearing temp
  2. --reset-cache
  3. npm-install

Without watchman packager takes nearly ~5 mins. App works.

[3:01:12 PM] request:/index.android.bundle?platform=android&dev=true&hot
=false&minify=false
[3:05:54 PM] Crawling File System (505632ms)

@sunnylqm
Copy link
Contributor

@dimitrovskif I really appreciate your work! And I mentioned this post on watchman repo, the man in charge said they need a separate issue there and detailed information. facebook/watchman#19 (comment) So can you post it there? Thank you so much!

@AleCaste
Copy link

I am experiencing the same issue on a Windows 7-64 machine.
Without watchman enabled, the packager takes more than 10 minutes.
With watchman enabled, only 2 seconds!!!
So there is definitely something wrong.
The watchman build I am using is:
https://ci.appveyor.com/api/buildjobs/kravw77nw7fqhvio/artifacts/watchman.zip

@MichelDiz
Copy link

I'm using the "The latest alpha build is available here:
http://bit.ly/watchmanwinalpha" from mitchellh. And OMG the build was taking like 10 min. With the Watchaman.exe tave 50s !!!! Has to be in the same folder/path

@christopherdro christopherdro added Platform: Windows Building on Windows. and removed Platform: Windows Building on Windows. labels Feb 20, 2017
@chroufa1
Copy link

i am having this problem with react native poject ``
│ Running packager on port 8081. │

│ │

│ Keep this packager running while developing on any JS projects. Feel │

│ free to close this tab and run your own packager instance if you │

│ prefer. │

│ │

https://github.com/facebook/react-native

│ │

└────────────────────────────────────────────────────────────────────────────┘

Looking for JS files in
C:\Users\asus\Desktop\AwesomeProject

Loading dependency graph...
React packager ready.

Loading dependency graph, done.
Bundling index.android.js 100.0% (404/404), done.
SyntaxError: Unexpected end of JSON input
at parse ()
at process._tickCallback (internal/process/next_tick.js:109:7)
{ Error: write EPIPE
at exports._errnoException (util.js:1050:11)
at Socket._writeGeneric (net.js:724:26)
at Socket._write (net.js:743:8)
at doWrite (_stream_writable.js:329:12)
at writeOrBuffer (_stream_writable.js:315:5)
at Socket.Writable.write (_stream_writable.js:241:11)
at Socket.write (net.js:670:40)
at Socket.Writable.end (_stream_writable.js:475:10)
at Socket.end (net.js:440:31)
at Promise.resolve.then.then.then.catch.then.message (C:\Users\asus\Desktop
AwesomeProject\node_modules\react-native\packager\src\Server\symbolicate\worker.
js:35:33) code: 'EPIPE', errno: 'EPIPE', syscall: 'write' }

any solution please :)

@chroufa1
Copy link

i am using windows 7 64bits and i i do not have not installed watchmen

@hramos
Copy link
Contributor

hramos commented Jul 20, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos added the Icebox label Jul 20, 2017
@hramos hramos closed this as completed Jul 20, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Windows Building on Windows. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests