How can I resolve a TypeError using old version of ember and ember-light-table?

Viewed 243

I have the test project at https://github.com/ericg-ember-questions/test_computed_sort

I setup the project by doing the following:

Node version: v12.18.1 (npm v6.14.5)

  1. npm install --save-dev ember-cli@3.4
  2. ./node_modules/.bin/ember new test_computed_sort
  3. cd test_computed_sort/
  4. ./node_modules/.bin/ember install ember-light-table@1.13.2
  5. ./node_modules/.bin/ember generate component test-comp
  6. ./node_modules/.bin/ember serve

application.hbs

{{test-comp}}

test-comp.hbs

Hello

{{#light-table}}
{{/light-table}}

If I comment out the reference to light-table, no error is generated. However, with it, I see in the console:

media.js:15 Uncaught TypeError: decorator is not a function
    at media.js:15:1
    at Array.reduce (<anonymous>)
    at _applyDecoratedDescriptor (media.js:15:1)
    at Module.callback (media.js:240:1)
    at Module.exports (loader.js:106:1)
    at Module._reify (loader.js:143:1)
    at Module.reify (loader.js:130:1)
    at Module.exports (loader.js:104:1)
    at requireModule (loader.js:27:1)
    at Class._extractDefaultExport (index.js:432:1)

What can I do to resolve this error so I can use ember-light-table with this project?

1 Answers

The error kinda hints at this, but it doesn't really make sense unless you're using modern ember -- but you're using 3.4 (thanks for providing that information!!)

The stack in your error is actually very helpful, and here's how you can figure out what the issue is.

I downloaded your reproduction repo (thanks for providing that! reproductions are immensely helpful in debugging!)

I got the same error you did: screenshot of error, decorator is not a function with top of stack

The key piece here is the media.js reference. Clicking into that we see: ""

that the compiled version of the ember-responsive/services/media file is using decorators -- you have some version of ember-responsive in your app which has decorators.

I saw in your package.json that you're specifying on alder version:

    "ember-responsive": "^4.0.2",

this v4 version of ember-responsive only supports ember 3.13 and higher.

Kinda poking around the ember-responsive github, https://github.com/freshbooks/ember-responsive/blob/v3.0.5/config/ember-try.js

I see that the v3 series of ember-responsive supports back to Ember 2.12 -- definitely before decorators before supported.

So downgrading ember-responsive and restarting the app reveals this error:

"Assertion Failed: [ember-light-table] table must be an instance of Table"

this error is documented here: https://github.com/adopted-ember-addons/ember-light-table/issues/726

so it looks like some APIs usage issue.

If you want help figuring that out, feel free to post another question.

Related