# Uncaught TypeError: $(...).fitVids is not a function -SAGE 9

**URL:** <https://discourse.roots.io/t/uncaught-typeerror-fitvids-is-not-a-function-sage-9/12900>\
**Category:** sage\
**Tags:** sage9, webpack\
**Created:** [July 10, 2018, 11:51pm UTC](https://discourse.roots.io/t/uncaught-typeerror-fitvids-is-not-a-function-sage-9/12900 "2018-07-10T23:51:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![weizung](https://discourse.roots.io/user_avatar/discourse.roots.io/weizung/32/4733_2.png) [@weizung](https://discourse.roots.io/u/weizung)\
**Post date:** [July 10, 2018, 11:51pm UTC](https://discourse.roots.io/t/uncaught-typeerror-fitvids-is-not-a-function-sage-9/12900/1 "2018-07-10T23:51:06Z")

</div>

Try to install the `fitvids` with the latest Sage 9, but it keep giving me an error.

```
import {fitvids} from 'fitvids';

$('body').fitVids();

Uncaught TypeError: $(...).fitVids is not a function
at Object.init (common.js:46)
at Router.fire (Router.js:30)
at Router.loadEvents (Router.js:45)
at HTMLDocument.<anonymous> (main.js:38)
at i (jquery-1.12.4.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.12.4.min.js:2)
at Function.ready (jquery-1.12.4.min.js:2)
at HTMLDocument.K (jquery-1.12.4.min.js:2)

```

Anyone?

Thanks!

---

<div class="post-metadata">

**Author:** ![alwaysblank](https://discourse.roots.io/user_avatar/discourse.roots.io/alwaysblank/32/11206_2.png) [@alwaysblank](https://discourse.roots.io/u/alwaysblank)\
**Post date:** [July 11, 2018, 12:04am UTC](https://discourse.roots.io/t/uncaught-typeerror-fitvids-is-not-a-function-sage-9/12900/2 "2018-07-11T00:04:24Z")

</div>

This should be sending up some red flags:

> [@weizung](#):
>
> `Uncaught TypeError: $(...).fitVids is not a function`

That means that JS is trying to execute a thing (who knows what it actually is) that it can’t execute. If you take a look at the source for fitVids, it looks like it doesn’t support being used as a JS module—specifically, it doesn’t `export` anything you can `import`. Instead, it just wants you to add it so it can hook in to jQuery.

My (untested) suggestion would be to do the following:

```js
import 'jquery'
import 'fitvids'

$(`body`).fitVids();

```

---

<div class="post-metadata">

**Author:** ![weizung](https://discourse.roots.io/user_avatar/discourse.roots.io/weizung/32/4733_2.png) [@weizung](https://discourse.roots.io/u/weizung)\
**Post date:** [July 11, 2018, 12:40am UTC](https://discourse.roots.io/t/uncaught-typeerror-fitvids-is-not-a-function-sage-9/12900/3 "2018-07-11T00:40:54Z")

</div>

thanks, but not working!

---

<div class="post-metadata">

**Author:** ![alwaysblank](https://discourse.roots.io/user_avatar/discourse.roots.io/alwaysblank/32/11206_2.png) [@alwaysblank](https://discourse.roots.io/u/alwaysblank)\
**Post date:** [July 11, 2018, 12:54am UTC](https://discourse.roots.io/t/uncaught-typeerror-fitvids-is-not-a-function-sage-9/12900/4 "2018-07-11T00:54:55Z")

</div>

What else have you tried?

---

<div class="post-metadata">

**Author:** ![weizung](https://discourse.roots.io/user_avatar/discourse.roots.io/weizung/32/4733_2.png) [@weizung](https://discourse.roots.io/u/weizung)\
**Post date:** [July 11, 2018, 1:16am UTC](https://discourse.roots.io/t/uncaught-typeerror-fitvids-is-not-a-function-sage-9/12900/5 "2018-07-11T01:16:28Z")

</div>

switch it to `fluidvids.js`

> **[toddmotto/fluidvids](https://github.com/toddmotto/fluidvids)**
>
> fluidvids - Fluid width (responsive) videos module, 1KB, custom players, dynamic elements/XHR support.
