ember-light-table icon indicating copy to clipboard operation
ember-light-table copied to clipboard

Assertion Failed: Attempting to inject an unknown injection: 'service:media'

Open gudyo opened this issue 7 years ago • 8 comments

I keep getting this error no matter what I do. I even copied the examples and same thing. I tried having a completely empty table, as well as one only with columns and empty rows. I still get the error. What is this service media - i see it is referenced in one of the mixins - and how do i get it and why do i need to have it if it isn't in the examples?

gudyo avatar Aug 15 '17 09:08 gudyo

@gudyo There's likely an error with your installation. see https://github.com/offirgolan/ember-light-table/issues/367 and let us know if that fixes it

alexander-alvarez avatar Aug 15 '17 14:08 alexander-alvarez

install ember-responsive light-table uses the media service from ember-responsive since 1.5.0, but the dependency was added only in devDependencies instead of dependencies. media service injection

Shadowere avatar May 03 '18 19:05 Shadowere

the dependency was added only in devDependencies instead of dependencies.

That should not matter, since properly installing ember-light-table via

ember install ember-light-table

will also call this hook:

https://github.com/offirgolan/ember-light-table/blob/5dccab6a47644eef0381b30004802aa88958f176/blueprints/ember-light-table/index.js#L7-L9

This error can also arise, if you try to use ember-light-table inside an engine and forget to expose the media service to the engine.

buschtoens avatar May 06 '18 11:05 buschtoens

The problem can arise quite often if you work on multiple projects and just copy the dependencies from one project to the other and run npm install, or if you just update de dependency directly in the package json for exemple. Yes it works if you ember install the addon everytime, but it's far from foolproof. Foolproof would be to add the project in the dependencies.

Sent from Ninehttp://www.9folders.com/


From: Jan Buschtöns [email protected] Sent: Sunday, May 6, 2018 07:06 To: offirgolan/ember-light-table Cc: Bobby Mousseau; Comment Subject: Re: [offirgolan/ember-light-table] Assertion Failed: Attempting to inject an unknown injection: 'service:media' (#476)

Closed #476https://github.com/offirgolan/ember-light-table/issues/476.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/offirgolan/ember-light-table/issues/476#event-1611639205, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGopeY9vbobo_Gfsf4R0k9KHeHJpbWnVks5tvtk4gaJpZM4O3XJK.

Shadowere avatar May 06 '18 15:05 Shadowere

That's a valid objection. I can't recall exactly, but I think there's another gotcha with adding it as a dependency.

What do you think about checking that the the addon is installed and throwing an error, if not?

buschtoens avatar May 06 '18 16:05 buschtoens

I understand the bad ergonomics that we currently have to deal with, but we need to make sure ember responsive is installed on the top level project -- adding it do our dependencies won't satisfy this.

Currently we do so by staying in our docs that you have to ember install ELT.

If we could enforce this via code and fail the build if there is no ember-responsive at the top level, that would be an improvement that would be quite useful in debugging this frustrating experience.

alexander-alvarez avatar May 06 '18 17:05 alexander-alvarez

I'm positive that there are some hooks and helper methods we can use during the initial application boot to verify, that the required dependency is installed.

buschtoens avatar May 06 '18 21:05 buschtoens

Heh, I just combed through my app during an upgrade and removed a bunch of dependencies I thought I wasn't using. ember-responsive got the axe by accident, and here I am. Welp. :P

Even if the build-time checks are tricky/non-doable, some sort of run-time warning/error in the map that says "hey, install ember-responsive, mate!" would be handy, IMO.

XaserAcheron avatar Jan 24 '19 19:01 XaserAcheron