Ember-cli: Live reload not working

2019-06-20 04:18发布

I started my first project with ember cli and I noticed that the live reload isn't working. When I start the development server, I get multiple error messages (see below). Changes to the code base are only available after a restart of the server.

$ ember server
version: 0.1.2
Livereload server on port 35729
Serving on http://0.0.0.0:4200/
2014-12-03 17:51 ember[16491] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)
2014-12-03 17:51 ember[16491] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)
...
2014-12-03 17:51 ember[16491] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)
2014-12-03 17:51 ember[16491] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)

Build successful - 1180ms.

Slowest Trees                  | Total          
-------------------------------+----------------
Concat                         | 368ms          
ES6Concatenator                | 150ms          
ES3SafeFilter                  | 149ms          
JSHint - App                   | 104ms          
JSHint - Tests                 | 80ms

At this stage I have the following packages/addons installed:

 DEBUG: -------------------------------
 DEBUG: Ember      : 1.7.0
 DEBUG: Ember Data : 1.0.0-beta.10
 DEBUG: EmberFire  : 1.3.1
 DEBUG: Handlebars : 1.3.0
 DEBUG: jQuery     : 1.11.1
 DEBUG: -------------------------------

Any idea what could cause this issue? It is quite annoying to restart the server for every change. Thank you for your suggestions.

2条回答
冷血范
2楼-- · 2019-06-20 04:39

Add this parameters(liveReload and Watcher) to the file

/.ember-cli
and this will end with something like this:

{
  /**
    Ember CLI sends analytics information by default. The data is ...
  */

  "disableAnalytics": false,
  "liveReload": true,
  "watcher": "polling" 
}
/* Pooling, this is where the magic come, allow to edit file in the host and outside(EX: Virtual machines and servers relate) */
查看更多
forever°为你锁心
3楼-- · 2019-06-20 04:57

The error is essentially caused by FSEvents watching too many files. If you're using Sublime Text, try excluding node_modules/, tmp/, and dist/ from your project (add them to the folder_exclude_patterns array in your Sublime user preferences).

If you're not using Sublime, or if doing so doesn't fix the issue, try upgrading your version of Node and version of ember-cli to the latest versions, as well as installing watchman using brew install watchman if you have Homebrew installed/are on OS X (as the latest versions of ember-cli no longer rely on FSEvents.

Source: https://github.com/ember-cli/ember-cli/issues/1260#issuecomment-67549158

查看更多
登录 后发表回答