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

ember 2.3.0 and ember-cli-fastboot raise document is not defined error #87

Closed
cs3b opened this issue Jan 18, 2016 · 4 comments
Closed

Comments

@cs3b
Copy link
Contributor

cs3b commented Jan 18, 2016

when trying to launch ember fastboot I've got:

DEBUG=ember-cli-fastboot:* ember fastboot --serve-assets
version: 2.2.0-beta.6
Built project successfully. Stored in "fastboot-dist".
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
DEPRECATION: `ember-cli/lib/errors/silent.js` is deprecated, use `silent-error` instead.
  ember-cli-fastboot:ember-app app created; app=fastboot-dist/assets/chirper.js; vendor=fastboot-dist/assets/vendor.js +0ms
WARNING: FEATURE["ember-application-visit"] is set as enabled, but FEATURE flags are only available in canary builds.
document is not defined
ReferenceError: document is not defined
    at <anonymous>:110604:16969

and here is my env:

ember-cli: 2.2.0-beta.6
ember: 2.3.0
ember-cli-fastboot:  0.1.0
ember-data: 2.3.1
node: 5.4.0

--- update 18/01/16 13:40 ---

I've updated to 059c0ad (master), by ember install https://github.com/tildeio/ember-cli-fastboot.git unfortunately still the same issue.

DEBUG=ember-cli-fastboot:* ember fastboot --serve-assets
version: 2.2.0-beta.6
Built project successfully. Stored in "fastboot-dist".
  ember-cli-fastboot:ember-app app created; app=fastboot-dist/assets/chirper.js; vendor=fastboot-dist/assets/vendor.js +0ms
document is not defined
ReferenceError: document is not defined
    at <anonymous>:110604:16969

--- update 18/01/16 13:40 ---

I've no idea where / how should I start debugging it?

@danmcclain
Copy link
Member

@cs3b Check your vendor file at line 110604 in fastboot-dist

@cs3b
Copy link
Contributor Author

cs3b commented Jan 19, 2016

@danmcclain thanks for pointing me in that direction.

So far I get that
First I've issue with one library that wasn't ember add-on (sweetAlert.js) and depend on document object
after removing that lib from ember-cli-build.js things move further. Next I've encounter another problem with pretender library (similar problem with document object missing):
https://github.com/pretenderjs/pretender/blob/32607c5cec7329a5eab1f91335ebb62089b96e42/pretender.js#L29

So I switch to production environment ... and now the server is starting, but I've got another error:

#...
Error while processing route: index t.default.$ is not a function TypeError: t.default.$ is not a function
# ...
  ember-cli-fastboot:server finished handling; url=/ +52ms

As it's hard to track minified js, i've got back to development mode (this time without ember-cli-mirage)

Error while processing route: index _ember.default.$ is not a function TypeError: _ember.default.$ is not a function

So it looks for me like there is no JQuery ?
In the end this lead me to package ember-body-class that was using something like this:

// ...
      const $body = Ember.$('body');
// ...

So I've also disabled this package, and run it again this time the issue was:

undefined:54304
      _emberViewsSystemJquery.default(rootElement).off('.ember', '**').removeClass(ROOT_ELEMENT_CLASS);
                                     ^
TypeError: _emberViewsSystemJquery.default is not a function
    at exports.default._emberRuntimeSystemObject.default.extend.destroy (<anonymous>:54304:38)
    at superWrapper [as destroy] (<anonymous>:33142:22)
    at <anonymous>:11902:16
    at eachDestroyable (<anonymous>:12155:9)
    at Object.Container.destroy (<anonymous>:11900:7)
    at Object.Backburner.run (<anonymous>:11275:25)
    at Object.run [as default] (<anonymous>:31176:27)
    at exports.default._emberMetalMixin.Mixin.create.willDestroy (<anonymous>:43210:36)
    at superWrapper (<anonymous>:33142:22)
    at _emberRuntimeSystemObject.default.extend.willDestroy (<anonymous>:14474:19)

and this lead me to the (bugfix made recently, available only in canary revision)

emberjs/ember.js#12829

I will try the canary version of ember ...

@cs3b
Copy link
Contributor Author

cs3b commented Jan 19, 2016

after updating to

Ember : 2.5.0-canary+551a2312

It start working well :-)

Still without ember-body-class addon, as it still raise an error:

Error while processing route: index _ember.default.$ is not a function TypeError: _ember.default.$ is not a function
    at null.addClasses (<anonymous>:67470:39)

I've assume that this is an addon issue, and I'm closing this ticket.

Of course I would be very glad if anyone could explain that to me :-) in details (why I came across so many errors).

@rwjblue
Copy link
Member

rwjblue commented Jan 20, 2016

emberjs/ember.js#12829 was cherry-picked into release and beta branches as well. You can use any of the available branches at this point to get that fix.

cs3b added a commit to miksturait/coder-dojo-2015-ember-js-II-project that referenced this issue Jan 20, 2016
cs3b added a commit to miksturait/coder-dojo-2015-ember-js-II-project that referenced this issue Jan 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants