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.

Dependency issue with @nuxtjs/composition-api

See original GitHub issue

I’m trying to use @vueuse/core with @nuxtjs/composition-api in my Nuxt project. And I get a error message:

This dependency was not found:
* @vue/composition-api/dist/vue-composition-api.esm.js in ./node_modules/vue-demi/lib/index.mjs

But @vue/composition-api have been install. Because @vue/composition-api is also @nuxtjs/composition-api’s dependency. I have no idea how to fix it.

Here is reproduction link: codesandbox

Have any solution to fix this? Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:22 (8 by maintainers)

github_iconTop GitHub Comments

7reactions
Kematiacommented, Jul 23, 2021

If you’re on Netlify try adding a .nvmrc file with your desired node version, this fixed it for me!

image

4reactions
TonyPythoneercommented, Jul 19, 2021

Hi @antfu @Ricklin90085

Before this PR nuxt-community/composition-api#517 gets merged, I have another workaround to this issue. It’s worked to me.

import { resolve } from 'path'
const vueCompositiobnAPIFullpath = resolve("./node_modules/@vue/composition-api/dist/vue-composition-api.esm.js");

config = {
  alias: {
    // keep default settings
    '~~': resolve(__dirname, './'),
    '@@': resolve(__dirname, './'),
    '~': resolve(__dirname, './'),
    '@': resolve(__dirname, './'),
    'assets': resolve(__dirname, './assets'), // (unless you have set a custom `dir.assets`)
    'static': resolve(__dirname, './static'), // (unless you have set a custom `dir.static`)
    // workaround
    '@vue/composition-api/dist/vue-composition-api.esm.js': vueCompositiobnAPIFullpath,
  },
}

Thanks to the @antfu 's answer, he inspires me to have this workaround.


So, when we have this workaround, we can enjoy @vueuse 's charm. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt Composition API
Vue 3 Composition API. Get all the Composition API features in Nuxt 2. ; SSR features. Additional helpers to interact with SSR. ;...
Read more >
How can i solve Nuxt.js cannot find module '@vue ...
I've found out this error is being caused by Vuter extension. This extension is requiring composition API which is ...
Read more >
@nuxtjs/composition-api - npm
Composition API hooks for Nuxt. Latest version: 0.33.1, last published: 5 months ago. Start using @nuxtjs/composition-api in your project by ...
Read more >
Composition API FAQ - Vue.js
Composition API is a set of APIs that allows us to author Vue components ... us to leverage Vue's dependency injection system while...
Read more >
@nuxtjs/composition-api | Yarn - Package Manager
config - you should remove any entry for @nuxtjs/composition-api there. When used outside a Nuxt context, the module will 'auto-mock' and use https://github.com ......
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