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.

Error: [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function in typescripts

See original GitHub issue

Hello,

I’m having trouble using your library to implement some functions in typescript. Is showing me the message

"Error: [vue-composition-api] must call Vue.use (VueCompositionAPI) before using any function."

I leave below the error output. I will appreciate your help and your prompt response.!!

import {ref, reactive, UnwrapRef, Ref } from 'vue-demi';

export function fxReactive<T extends object>(obj: T): UnwrapRef<T> {
  return reactive(obj);
}

const fx = fxReactive({
  data: []
});

console.log(fx.data);

devDependecies

"@vue/composition-api": "^1.0.0-beta.1",
"vue": "^2.6.11"

dependecies

"vue-demi": "latest"

error

C:\Users\c\Desktop\reactivefx\node_modules\@vue\composition-api\dist\vue-composition-api.common.js:43
        throw new Error("[vue-composition-api] " + msg);
              ^
Error: [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function.
    at assert (C:\Users\c\Desktop\reactivefx\node_modules\@vue\composition-api\dist\vue-composition-api.common.js:43:15)
    at getVueConstructor (C:\Users\c\Desktop\reactivefx\node_modules\@vue\composition-api\dist\vue-composition-api.common.js:83:9)
    at observe (C:\Users\c\Desktop\reactivefx\node_modules\@vue\composition-api\dist\vue-composition-api.common.js:470:15)
    at Function.reactive (C:\Users\c\Desktop\reactivefx\node_modules\@vue\composition-api\dist\vue-composition-api.common.js:595:20)
    at fxReactive (C:\Users\c\Desktop\reactivefx\src\index.ts:6:10)
    at Object.<anonymous> (C:\Users\c\Desktop\reactivefx\src\index.ts:9:12)
    at Module._compile (internal/modules/cjs/loader.js:1176:30)
    at Module.m._compile (C:\Users\c\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:473:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\c\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:476:12)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
antfucommented, Aug 20, 2020

Planned to make one but didn’t get time to do so. You might want to check the simple demo in the examples for now.

0reactions
ChrisMichaelPerezSantiagocommented, Aug 20, 2020

@antfu ,

Any starter template that you recommend?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught Error: [vue-composition-api] must call Vue.use ...
This problem was fixed by a friend on the Vue.js forum. For anyone else who is running into this issue I'll post his...
Read more >
【Bug】 Uncaught Error: [vue-composition-api] must call Vue ...
I must reopen this issue, and I am referring to #621. ... must call Vue.use(VueCompositionAPI) before using any function #895.
Read more >
Uncaught Error: [vue-composition-api] must call Vue.use ...
Coding example for the question Uncaught Error: [vue-composition-api] must call Vue.use(plugin) before using any function-Vue.js.
Read more >
TypeScript with Composition API - Vue.js
You can use either type-based declaration OR runtime declaration, but you cannot use ... The type argument should be a type literal with...
Read more >
Composition API | FeathersVuex
... data(): "Error: [vue-composition-api] must call Vue.use(plugin) before using any function. ... The next few sections show various TypeScript interfaces, ...
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