I'm migrating my project from a situation where it was a nested asset in a Rails app to a separate frontend with Ember-Cli. And I've been stuck with the following problem for quite some time now:
When running $ Ember serve
in my terminal and opening localhost:4200
with Chrome I get the following error in the console: Uncaught TypeError: undefined is not a function
in app-boot.js:25
On that line the following code is present:
require("my_app/app")["default"].create({
"defaultLocale":"en",
"name":"my_app",
"version":"0.0.0.bece32c1"
});
I added a breakpoint on that line and checked if require("my_app/app"
was defined, and it was Object {default: Class}
so I checked if the default object property was defined, and this also was the case:
Class {modulePrefix: "my_app", podModulePrefix: undefined,
Resolver: function, _readinessDeferrals: 1, $: function…}
The console output of require("my_app/app")["default"]
can be seen in the following screenshot:
This is the content of my config/environment
file:
And this is the content of my app/index.html
file:
And this is the content of my app/app.js
file:
I'm using the latest version of Ember-cli, Ember v1.10.0, ember-data v1.0.0-beta.15 and Jquery 1.11.2
============= Update 1: origin of app-boot.js ==================
Someone asked where the app-boot.js
was located as he was only familiar with https://github.com/ember-cli/ember-cli/blob/master/lib/broccoli/app-boot.js
Below is a screenshot of the resources pane in Chrome, showing that it is in fact a compiled vendor asset of ember-cli.
== Update 2: commenting I18N import and include constants in initialisation ==
I did do some refactoring and commented the I18N import that maybe is conflicting. I also included the constants inside the Ember app initialisation. see screenshot below for current version of app.js
:
I didn't edit my Brocfile.js
as far as I know but decided to include a screenshot of it anyway because maybe it contains a bug.. you never know..
I hope someone knows a solution for this problem or can point me in the right direction. If you need more information don't hesitate to ask!
Thanks in advance,
Alexander Jeurissen
As collaboratively (see discussion) traced:
Use
Ember.Application.extend
instead of
Ember.Application.create
in your app\app.js
(like in https://github.com/ember-cli/ember-cli/blob/master/blueprints/app/files/app/app.js).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With