Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install @nuxtjs/composition-api anymore #644

Closed
ThinkingAbout opened this issue Jul 4, 2022 · 10 comments · Fixed by #645
Closed

Can't install @nuxtjs/composition-api anymore #644

ThinkingAbout opened this issue Jul 4, 2022 · 10 comments · Fixed by #645
Assignees
Labels
bug Something isn't working

Comments

@ThinkingAbout
Copy link

I can't install the composition api package anymore on fresh nuxt projects.

I've just created a new blank nuxt project with npm init nuxt-app my-project-name and and immediately after I installed @nuxtjs/composition-api using npm and following the steps in the docs.

I get the following error:

Vue packages version mismatch:
  
  - vue@2.6.14
  - vue-server-renderer@2.7.1
  
  This may cause things to work incorrectly. Make sure to use the same version for both.

Schermata 2022-07-04 alle 16 00 16

  • OS: MacOs Monteray 12.4
  • node -v v16.15.1
  • npm -v 8.11.0

Can somebody help please?

Matteo

@ThinkingAbout ThinkingAbout added the bug Something isn't working label Jul 4, 2022
@ThinkingAbout
Copy link
Author

It looks like that the problem also occurs in previous projects by deleting the package-lock file and running npm install again.
Thanks,
Matteo

@ThinkingAbout ThinkingAbout changed the title Can't install @nuxtjs/composition-api Can't install @nuxtjs/composition-api anymore Jul 4, 2022
@ThinkingAbout
Copy link
Author

Hi, Am I the only one experiencing the problem? The issue for me is highly replicable on different systems (os and node versions), just by installing the @nuxtjs/composition-api package in a nuxt starter project.

@vahid-bagheri
Copy link

I can't install the composition api package anymore on fresh nuxt projects.

I've just created a new blank nuxt project with npm init nuxt-app my-project-name and and immediately after I installed @nuxtjs/composition-api using npm and following the steps in the docs.

I get the following error:

Vue packages version mismatch:
  
  - vue@2.6.14
  - vue-server-renderer@2.7.1
  
  This may cause things to work incorrectly. Make sure to use the same version for both.

Schermata 2022-07-04 alle 16 00 16

  • OS: MacOs Monteray 12.4
  • node -v v16.15.1
  • npm -v 8.11.0

Can somebody help please?

Matteo

I have The Same Problem too :(

@danielroe
Copy link
Member

This is an issue with your specific package manager and lockfile situation, and on every Vue upgrade there are often mismatches which people need to resolve by updating their lockfiles and/or explicitly installing the right version of Vue packages. But it is not an issue with @nuxtjs/composition-api. In fact, this library has no explicit vue or vue-server-renderer dependencies.

Here's an example working fine with the latest Nuxt 2.15.8 and Composition API: https://stackblitz.com/edit/github-4nyzv3.

@ThinkingAbout
Copy link
Author

ThinkingAbout commented Jul 5, 2022

Hi @danielroe,
so at the moment @nuxtjs/composition-api can't be installed using NPM?
Anyway, I immediately tried to switch to yarn instead of npm. The package installs correctly but I have #643.
You can replicate it by simply adding:

<script>
import { useContext } from "@nuxtjs/composition-api";
export default {
  setup() {
    const context = useContext();
    console.log(context);
  },
};
</script>

https://stackblitz.com/edit/github-4nyzv3-zdknmq?file=pages%2Findex.vue

Thanks

@bobbyadamski
Copy link

By forcing vue version to 2.6.14 temporary fixt the issue

https://stackblitz.com/edit/github-4nyzv3-cmdcxr?file=package.json

@ThinkingAbout
Copy link
Author

@bobbyadamski with 2.6.14 I was able to run the project again.
@danielroe I tried with 2.7 but same error occured, am I doing something wrong?

https://stackblitz.com/edit/github-4nyzv3-zdknmq?file=package.json

Thanks

@Jozaguts
Copy link

Jozaguts commented Jul 7, 2022

I had the same problem, and I was "fix it" with:

  • removing "^" in these 2 packages:
    • "vue-server-renderer": "2.6.14",
    • "vue-template-compiler": "2.6.14"

Delete

  • package-lock.json
  • node_modules

run npm install

and now I have this message

Nuxt Bridge has now been released in beta. It has full composition API support and it's strongly recommended to migrate from @nuxtjs/composition-api, if possible
, by following the steps at https://v3.nuxtjs.org/getting-started/bridge. Feedback welcome at #585.

i Waiting for file changes                                                                                                                              
i Memory usage: 376 MB (RSS: 468 MB)                                                                                                                    
i Listening on: http://localhost:3000/                                                                                                                  
No issues found.```

I hope this helps you!

@ThinkingAbout
Copy link
Author

@Jozaguts thanks but same error :(
@bobbyadamski solution is still the only one that works for me.

@Marahin
Copy link

Marahin commented Jul 7, 2022

I have the exact same issue as @ThinkingAbout, however, I'm unable to force the dependencies and their versions lower.

danielroe added a commit that referenced this issue Jul 8, 2022
BREAKING CHANGE: Some of the API and behaviour differ between Vue 2.7 and `@vue/composition-api`. In addition, there are some composition utilites that are no longer exported from `@nuxtjs/composition-api`, such as `defineAsyncComponent`, `warn`, etc.

Please read https://blog.vuejs.org/posts/vue-2-7-naruto.html for the announcement and more information.

resolves #644, resolves #643, resolves #593, resolves #19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants