question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A plugin must either be a function or an object with an "install" function

See original GitHub issue

Describe the bug I am not able to install the plugin. I receive a warning on the vue console in my browser. [Vue warn]: A plugin must either be a function or an object with an "install" function.

To Reproduce

This is my main.js

import { createApp } from 'vue';
import { createRouter, createWebHistory } from 'vue-router';

import { ActionCableVue } from 'actioncable-vue';

import App from './App.vue';
import GameComponent from './components/GameComponent.vue';
import HomeComponent from './components/HomeComponent.vue';

const app = createApp(App)
const routes = [
  { path: '/home', component: HomeComponent },
  { path: '/game', component: GameComponent }
]

const router = createRouter({
  mode: 'history',
  history: createWebHistory(),
  routes: routes
})

app.use(router)

app.use(ActionCableVue, {
  debug: true,
  debugLevel: 'error',
  connectionUrl: 'ws://localhost:3000/api/cable',
  connectImmediately: true,
})

app.mount('#app')

Expected behaviour I would expect that $cable is ready to use in my components.

Screenshots

This is a screenshot from the browser console

image

These are my used packages which includes the vue version

image

Plugin version: 2.3.2

Additional context I am new to vue and I am using the newest version of vue 3.0.0. The project is started fresh.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
mclintprojectscommented, Oct 10, 2020

@DenniJensen This plugin currently only supports Vue 2.0. I’ll look into adding Vue 3.0 support as soon as I can.

1reaction
mclintprojectscommented, Dec 30, 2020

@docming @DenniJensen @timmaier Vue 3 support just went live thanks to #37. Kindly update to actioncable-vue 2.4.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Vue warn]:A plugin must either be a function or an object with ...
I use click-outside-vue3' as directive with Nuxt3. Had the same issue. The reason was that I had: import ClickOutside from ...
Read more >
Plugins - Vue.js
A plugin is defined as either an object that exposes an install() method, or simply a function that acts as the install function...
Read more >
[Vue warn]: A plugin must either be a function or an object with ...
Developers - [Vue warn]: A plugin must either be a function or an object with an "install" function. Vue test utils -
Read more >
A plugin must either be a function or an object with an “install ...
A plugin must either be a function or an object with an “install “ function. 别说小李 于 2022-05-20 16:58:22 发布 339 收藏. 分类专栏:...
Read more >
The Complete Guide to Vue 3 Plug-ins: Part 2 - CODE Magazine
This function accepts, as a first input, an object representing the plug-in and having an install() function. It also accepts a function ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found