0

I am trying to install Nuxt.js v3.4.2 using the command npx nuxt init nuxt3-demo and then running npm install. However, I am getting the following error message:

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

I have tried updating the 'vue' package, but it did not solve the issue. My package.json file looks like this:

  {
    "name": "nuxt-app",
    "private": true,
    "scripts": {
      "build": "nuxt build",
      "dev": "nuxt dev",
      "generate": "nuxt generate",
      "preview": "nuxt preview",
      "postinstall": "nuxt prepare"
    },
    "devDependencies": {
      "@types/node": "^18",
      "nuxt": "^3.4.2"
    }
  }

Can anyone suggest a solution for this error?

Syed Sajid
  • 1,380
  • 5
  • 20
  • 34
  • What happens when you use `npx nuxi upgrade` (or `npx nuxi upgrade --force`) ? – Eflyax Apr 27 '23 at 11:59
  • Nothing happens, it throws the same ERROR: Vue packages version mismatch – Syed Sajid May 01 '23 at 05:50
  • I had this error and another error related to node-gyp during package installation (npm install). I ended up installing Visual Studio with the `Desktop development with c++` option checked and the errors disappeared! – EspressoCode May 01 '23 at 06:10
  • what does it say when you run `npx nuxi info`? – Moritz Ringler May 04 '23 at 20:21
  • At what point do you get the error? I ran `npx nuxt init nuxt3-demo` then `pnpm install` then `pnpm dev` and it worked fine with no issues. It installed `nuxt@3.4.3` – Kalimah May 07 '23 at 16:09

2 Answers2

0

As a solution, you can:

1 - try npm install after removing the "node_modules" folder and the "package-lock.json" file.

2 - Try yarn install.

3 - Try again with the new version, v3.4.3.

I edited this because, as Wongjn said, I asked for clarification. However, providing a minimal, reproducible example would be nice, given the nature of the problem and how hard replicating the issue is.

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/34334192) – Wongjn May 04 '23 at 19:33
  • The question requested a solution, which I gave. Based on my experience, since I could not replicate the issue. But you were right, and I will avoid asking for clarification in answers. – DikurikuDev May 05 '23 at 01:20
0

This is because vue-server-renderer is only for Vue2 and not for Vue3. Source

Just remove the package vue-server-renderer, you'll get SSR features from nuxt.

npm remove vue-server-renderer

Then, delete your node_modules folder, then try again: npx nuxt init nuxt3-demo.

Jishan Shaikh
  • 1,572
  • 2
  • 13
  • 31