Ember-cli: Live reload not working - ember.js

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.

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

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) */

Related

Cannot find module './transforms/babel-plugin-convert-existence-checks-to-macros'

I've recently updated ember-cli and my app to 4.10.0, and trying to build with:
ember serve
throws the following error:
Cannot find module './transforms/babel-plugin-convert-existence-checks-to-macros'
I've looked to see what module is missing. I came up with trying to install/reinstall ember-cli-babel and that didn't work either.
The ember app is on LAMP: Raspbian Linux 11 OS, Apache 2.4.54, MariaDB 10.5.15, and PHP/Laravel 8 backend
ember-cli: 4.10.0
ember-source: 4.10.0
ember-cli-babel: 7.26.11
I don't have any special ember-cli-build configurations, here it is:
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
const app = new EmberApp(defaults, {
});
return app.toTree();
}
EDIT: ERROR STACK
- name: Error
- nodeAnnotation: [undefined]
- nodeName: [undefined]
- originalErrorMessage: [undefined]
- stack: Error: Cannot find module './transforms/babel-plugin-convert-existence-checks-to-macros'
Require stack:
- /var/www/html/.../node_modules/#ember-data/private-build-infra/src/debug-macros.js
- /var/www/html/.../node_modules/#ember-data/private-build-infra/src/stripped-build-plugins.js
- /var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js
- /var/www/html/.../node_modules/ember-data/index.js
- /var/www/html/.../node_modules/ember-cli/lib/models/package-info-cache/package-info.js
- /var/www/html/.../node_modules/ember-cli/lib/models/package-info-cache/index.js
- /var/www/html/.../node_modules/ember-cli/lib/models/project.js
- /var/www/html/.../node_modules/ember-cli/lib/utilities/get-config.js
- /var/www/html/.../node_modules/ember-cli/lib/utilities/instrumentation.js
- /var/www/html/.../node_modules/ember-cli/lib/cli/index.js
- /usr/local/lib/node_modules/ember-cli/bin/ember
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Function.resolve (node:internal/modules/cjs/helpers:109:19)
at debugMacros (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/debug-macros.js:6:44)
at module.exports (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/stripped-build-plugins.js:11:48)
at Class.buildBabelOptions (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js:149:62)
at Class._setupBabelOptions (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js:168:33)
at Class.included (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js:184:12)
at Class.superWrapper [as included] (/var/www/html/.../node_modules/core-object/lib/assign-properties.js:34:20)
at /var/www/html/.../node_modules/ember-cli/lib/models/addon.js:497:26
at Array.reduce (<anonymous>)
at Class.eachAddonInvoke (/var/www/html/.../node_modules/ember-cli/lib/models/addon.js:494:24)
at Class.included (/var/www/html/.../node_modules/ember-cli/lib/models/addon.js:769:10)
at Class.superWrapper [as included] (/var/www/html/.../node_modules/core-object/lib/assign-properties.js:34:20)
at Class.included (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js:174:28)
at Class.superWrapper [as included] (/var/www/html/.../node_modules/core-object/lib/assign-properties.js:34:20)
at /var/www/html/.../node_modules/ember-cli/lib/broccoli/ember-app.js:721:15
After days of googling and trying a variety of things, I was able to get my ember application to launch again. Here is what worked for me, for whatever reason.
I removed all the files inside my projects node_modules directory
sudo rm -r node_modules/*
and reinstalled all those packages with
npm install
After this, and I'm not sure if this really had anything to do with the resolution, I updated npm from 9.4.1 to 9.4.2
npm install -g npm#9.4.2
Once all of those commands executed successfully, I ran
ember serve
and I no longer received the above error.
I hadn't thought I ever used sudo to install any npm packages, at least I try to make it a habit not to. But, it's possible I screwed up during my many butchered attempts at updating my ember app from 4.9 to 4.10.

TypeError: Cannot read property 'serve:before' of undefined on Ionic CLI 2.2.1 + Gulp 4

I am developing a Web Application that have a lot of legacy dependencies.
On the trial of updating some packages, I updated the gulp/gulpfile.js and tinkered then to run. Gulp was on version 3.5 and now is on 4.0.
By the way, the error thrown in the terminal by running : ionic serve --address localhost --nobrowser is :
Error: spawn cordova EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please update your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************
TypeError: Cannot read property 'serve:before' of undefined
at Object.runWithGulp (/usr/lib/node_modules/ionic/lib/cli.js:237:17)
at Object.runr (/usr/lib/node_modules/ionic/lib/cli.js:194:18)
at /usr/lib/node_modules/ionic/lib/cli.js:54:9
at _fulfilled (/usr/lib/node_modules/ionic/node_modules/q/q.js:787:54)
at /usr/lib/node_modules/ionic/node_modules/q/q.js:816:30
at Promise.promise.promiseDispatch (/usr/lib/node_modules/ionic/node_modules/q/q.js:749:13)
at /usr/lib/node_modules/ionic/node_modules/q/q.js:557:44
at flush (/usr/lib/node_modules/ionic/node_modules/q/q.js:108:17)
at process._tickCallback (internal/process/next_tick.js:61:11)
Cannot read property 'serve:before' of undefined (CLI v2.2.1)
Your system information:
Cordova CLI: undefined
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 5.4
Node Version: v10.16.3
Xcode version: Not installed
Then, some patch of the gulpfile.js :
gulp.task('build', gulp.series('bundle', 'copyTask', 'revTask', 'revReplaceTask'));
gulp.task('default', gulp.series('sassTask', 'cleanTask', 'build', 'watchTask'));
gulp.task('serve:before', gulp.series('cleanTask', 'watchTask', 'build'));
Before the tinkering, gulp.task('serve:before' [...]) functioned well. I guess it is related with the Ionic 2.2.1 CLI.
If someone could help me by a hint or an advice for mismatching the problem, I would be glad.
This happened to me while I upgraded Node to v12 which forced me to upgrade Gulp to v4.
The solution that worked for me is:
Go to npm\node_modules\ionic\lib\cli.js (Wherever it's located).
Change the following lines as such in cli.js:
237: if (true || gulp.tasks[beforeHook]) {
257: if (true || gulp.tasks[afterHook]) {
270: return Q.nfcall(null/*gulp.start.bind(gulp)*/, hookName)
Basically, the reason is that gulp.tasks and gulp.start don't exist in Gulp v4.
By putting true || in the first occurrences, gulp.tasks won't run and by putting null in the last occurrence, the gulp.start won't run.
I hope this helps the next people that encounter this problem.

Ember CLI throws Unhandled 'error' event message

Ember CLI works great most of the time on my laptop. However, once in a while (very very occasionally) when I ctrl + c the ember server process and restart it, it throws the following error and refuses to start again until I do a complete system restart (I am on a Mac):
MacBook-Pro:client-web User$ ember server
version: 1.13.6
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/user-guide/#watchman for more info.
2015-09-04 17:46 ember[1102] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)
2015-09-04 17:46 ember[1102] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
2015-09-04 17:46 ember[1102] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)
events.js:85
throw er; // Unhandled 'error' event
^
Error: watch EMFILE
at exports._errnoException (util.js:746:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1157:26)
Why does this happen? I want to avoid doing system restarts.
Adding this as an answer because the Ember CLI docs no longer mention it, and it took me a while to track down:
Frequently, this problem is caused by Sublime Text watching the same files as the Ember server. If you're using Sublime and encountering this error, try closing Sublime and running the server again. To keep it from recurring, you can tell Sublime Text to ignore the tmp directory, by adding "tmp/*" to the"folder_exclude_patterns" in your Sublime user settings.

Puppet install gem fails but gem is installed anyways

I have a Puppet manifest that installs the Zurb Foundation gem:
class compass {
package { ["rubygems"]:
ensure => 'installed'
}
package { ['zurb-foundation']:
ensure => '3.0.6',
provider => 'gem',
require => Package['rubygems']
}
}
This causes the following error when running puppet apply:
err: /Stage[main]/Compass/Package[zurb-foundation]/ensure: change from absent to 3.0.6 failed: Could not update: Execution of '/usr/bin/gem install -v 3.0.6 --include-dependencies --no-rdoc --no-ri zurb-foundation' returned 1: INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Building native extensions. This could take a while...
ERROR: Error installing zurb-foundation:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.0/ext/ffi_c/gem_make.out
at /etc/puppet/manifests/classes/compass.pp:25
However, doing a gem list yields the following results:
# gem list
*** LOCAL GEMS ***
chunky_png (1.2.8)
compass (0.12.2)
fssm (0.2.10)
rake (10.1.0)
rb-fsevent (0.9.3)
sass (3.2.0.alpha.277)
zurb-foundation (3.0.6)
The error causes puppet apply to not complete properly, since a lot of items are skipped because of failed dependencies. What can I do?
I think that the problem is that you don't have the ruby dev kit installed for you ruby (that's what's used to build native extensions).
You'll want to add something like (it may be different depending on your version of ruby):
package { 'ruby-dev':
ensure => installed,
before => Package['zurb-foundation'],
}
This should allow the gem to be built properly and let your puppet run finish too.

Handlebars precompile version error with Ember rc1

Upgrading Ember to 1.0.0-rc1 results in the following error:
Uncaught Template was precompiled with an older version of Handlebars
than the current runtime. Please update your precompiler to a newer
version (>= 1.0.0-rc.3) or downgrade your runtime to an older version (<= 1.0.rc.2).
I am using a version of handlebars that should work according to the error message above:
DEBUG: Ember.VERSION : 1.0.0-rc.1 ember.js:339
DEBUG: Handlebars.VERSION : 1.0.0-rc.3 ember.js:339
DEBUG: jQuery.VERSION : 1.9.1
I also upgraded my ember-rails gem to 0.9.2
How do I get around this error?
This was caused by barber gem which is using handlebars rc2 for template precompilation. I've made a pull request which fixes it. If you need this working now, you can just use my fork :)
Update: instructions for using darthdeus fork:
1) Add the following to your Gemfile:
gem "barber", :git => "git://github.com/darthdeus/barber.git", :branch => "update-handlebars-to-rc3"
2) Clear your tmp dir
rm -rf tmp
3) Restart your server
edit: for future readers the changes have been merged now, so using a master branch from the official repo should work.