From 75b93f95bbe1f0a2326c4952dc21e18c8db15edb Mon Sep 17 00:00:00 2001 From: Daniel Rech Date: Mon, 21 Nov 2016 21:38:05 +0100 Subject: [PATCH 1/3] Add a note for OSX users about watchman and jest Minor additional information on how to solve watchman problems reported in #713 and #1767 --- packages/react-scripts/template/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 547fae13e8b..dab4878ecb6 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -675,6 +675,14 @@ The watcher includes an interactive command-line interface with the ability to r ![Jest watch mode](http://facebook.github.io/jest/img/blog/15-watch.gif) +>**A note for Mac OSX users** + +>If you start `npm test` and the execution hangs there might be a problem with your watchman installation as discovered in #713 and #1767. + +> To solve the issues first make sure you run the latest verision: `brew install watchman` (4.7.0). +Then execute `launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist`. After these steps the issues should be resolved. + + ### Version Control Integration By default, when you run `npm test`, Jest will only run the tests related to files changed since the last commit. This is an optimization designed to make your tests runs fast regardless of how many tests you have. However it assumes that you don’t often commit the code that doesn’t pass the tests. From bfe9054d0b49917fe0a6faeab568b84ccebee016 Mon Sep 17 00:00:00 2001 From: Daniel Rech Date: Tue, 22 Nov 2016 07:39:50 +0100 Subject: [PATCH 2/3] Introduced new Troubleshooting section Add better explanation how to solve #713 and linked related Issues. --- packages/react-scripts/template/README.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index dab4878ecb6..6b453372636 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -675,14 +675,6 @@ The watcher includes an interactive command-line interface with the ability to r ![Jest watch mode](http://facebook.github.io/jest/img/blog/15-watch.gif) ->**A note for Mac OSX users** - ->If you start `npm test` and the execution hangs there might be a problem with your watchman installation as discovered in #713 and #1767. - -> To solve the issues first make sure you run the latest verision: `brew install watchman` (4.7.0). -Then execute `launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist`. After these steps the issues should be resolved. - - ### Version Control Integration By default, when you run `npm test`, Jest will only run the tests related to files changed since the last commit. This is an optimization designed to make your tests runs fast regardless of how many tests you have. However it assumes that you don’t often commit the code that doesn’t pass the tests. @@ -1072,6 +1064,17 @@ Install the Surge CLI if you haven't already by running `npm install -g surge`. Note that in order to support routers that use HTML5 `pushState` API, you may want to rename the `index.html` in your build folder to `200.html` before deploying to Surge. This [ensures that every URL falls back to that file](https://surge.sh/help/adding-a-200-page-for-client-side-routing). +## Troubleshooting + +### Jest hangs during execution on Mac OSX + +If you start `npm test` and the execution hangs there might be a problem with your watchman installation as described in [#713](https://github.com/facebookincubator/create-react-app/issues/713). +Related Issues: [Jest #1767](https://github.com/facebook/jest/issues/1767), [ember-cli #6259](https://github.com/ember-cli/ember-cli/issues/6259) and [watchman #358](https://github.com/facebook/watchman/issues/358). + +To solve the issues first make sure you run at least watchman 4.7.0 or newer. (`brew install watchman`). + +Manually unloading the service with `launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist` is the workaround for this issue. + ## Something Missing? If you have ideas for more “How To” recipes that should be on this page, [let us know](https://github.com/facebookincubator/create-react-app/issues) or [contribute some!](https://github.com/facebookincubator/create-react-app/edit/master/packages/react-scripts/template/README.md) From 2e7e71d469f70422a796a83ac3b2b0a1a2b121d7 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Wed, 23 Nov 2016 13:16:41 +0000 Subject: [PATCH 3/3] Tweak wording and add it to TOC --- packages/react-scripts/template/README.md | 26 ++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 6b453372636..48409092a27 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -52,6 +52,7 @@ You can find the most recent version of this guide [here](https://github.com/fac - [Now](#now) - [S3 and CloudFront](#s3-and-cloudfront) - [Surge](#surge) +- [Troubleshooting](#troubleshooting) - [Something Missing?](#something-missing) ## Updating to New Releases @@ -1066,14 +1067,29 @@ Note that in order to support routers that use HTML5 `pushState` API, you may wa ## Troubleshooting -### Jest hangs during execution on Mac OSX +### `npm test` hangs on macOS Sierra -If you start `npm test` and the execution hangs there might be a problem with your watchman installation as described in [#713](https://github.com/facebookincubator/create-react-app/issues/713). -Related Issues: [Jest #1767](https://github.com/facebook/jest/issues/1767), [ember-cli #6259](https://github.com/ember-cli/ember-cli/issues/6259) and [watchman #358](https://github.com/facebook/watchman/issues/358). +If you run `npm test` and the console gets stuck after printing `react-scripts test --env=jsdom` to the console there might be a problem with your [Watchman](https://facebook.github.io/watchman/) installation as described in [facebookincubator/create-react-app#713](https://github.com/facebookincubator/create-react-app/issues/713). -To solve the issues first make sure you run at least watchman 4.7.0 or newer. (`brew install watchman`). +We recommend deleting `node_modules` in your project and running `npm install` (or `yarn` if you use it) first. If it doesn't help, you can try one of the numerous workarounds mentioned in these issues: -Manually unloading the service with `launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist` is the workaround for this issue. +* [facebook/jest#1767](https://github.com/facebook/jest/issues/1767) +* [facebook/watchman#358](https://github.com/facebook/watchman/issues/358) +* [ember-cli/ember-cli#6259](https://github.com/ember-cli/ember-cli/issues/6259) + +It is reported that installing Watchman 4.7.0 or newer fixes the issue. If you use [Homebrew](http://brew.sh/), you can run these commands to update it: + +``` +watchman shutdown-server +brew update +brew reinstall watchman +``` + +You can find [other installation methods](https://facebook.github.io/watchman/docs/install.html#build-install) on the Watchman documentation page. + +If this still doesn't help, try running `launchctl unload -F ~/Library/LaunchAgents/com.github.facebook.watchman.plist`. + +There are also reports that *uninstalling* Watchman fixes the issue. So if nothing else helps, remove it from your system and try again. ## Something Missing?