pinia icon indicating copy to clipboard operation
pinia copied to clipboard

npm error when installing pinia

Open matthiashermsen opened this issue 2 years ago • 22 comments

This issue might be a duplicate of https://github.com/posva/pinia/issues/724

I'm trying to install Pinia via npm but get a

ERESOLVE unable to resolve dependency tree

error.

Reproduction

  • OS: Win10 and Pop!_OS 21.04
  • Node version: v16.13.0
  • npm version: 8.1.0
  • Vue CLI version: 4.5.15
  • Vue version: 3.0.0

The project setup on Win10:

image

I created a temporary repository showing the inial commit after creating the project with the Vue CLI

https://github.com/matthiashermsen/temp-pinia

Steps to reproduce the behavior

  1. Clone the repository
  2. Run npm install
  3. Run npm install pinia
  4. You should get an error

Expected behavior

It should install the package without errors.

Actual behavior

This is the terminal error on Win10

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   peerOptional vue@"^2 || ^3.0.0-0" from @vue/[email protected]
npm ERR!   node_modules/@vue/babel-preset-app
npm ERR!     @vue/babel-preset-app@"^4.5.15" from @vue/[email protected]
npm ERR!     node_modules/@vue/cli-plugin-babel
npm ERR!       dev @vue/cli-plugin-babel@"~4.5.0" from the root project
npm ERR!   peer vue@"3.2.22" from @vue/[email protected]
npm ERR!   node_modules/@vue/server-renderer
npm ERR!     @vue/server-renderer@"3.2.22" from [email protected]
npm ERR!   5 more (@vue/test-utils, primevue, vue-jest, vue-router, the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! pinia@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 2.5 < 3" from @vue/[email protected]
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.4.0" from [email protected]
npm ERR!     node_modules/pinia
npm ERR!       pinia@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\me\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\me\AppData\Local\npm-cache\_logs\2021-11-26T09_39_36_434Z-debug.log

and this is the npm log file

0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'install',
0 verbose cli   'pinia'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 4ms
6 timing config:load:builtin Completed in 4ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:C:\Users\me\Repositories\repo\.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:C:\Users\me\.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:\Users\me\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 11ms
19 timing npm:load:configload Completed in 11ms
20 timing npm:load:setTitle Completed in 0ms
21 timing npm:load:setupLog Completed in 1ms
22 timing config:load:flatten Completed in 2ms
23 timing npm:load:cleanupLog Completed in 2ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 1ms
26 timing npm:load Completed in 18ms
27 timing arborist:ctor Completed in 1ms
28 timing idealTree:init Completed in 1304ms
29 timing idealTree:userRequests Completed in 4ms
30 silly idealTree buildDeps
31 silly fetch manifest pinia@*
32 timing arborist:ctor Completed in 0ms
33 http fetch GET 200 https://registry.npmjs.org/pinia 1424ms (cache revalidated)
34 silly fetch manifest @vue/composition-api@^1.4.0
35 http fetch GET 200 https://registry.npmjs.org/@vue%2fcomposition-api 87ms (cache revalidated)
36 silly fetch manifest vue@^3.0.0
37 http fetch GET 200 https://registry.npmjs.org/vue 55ms (cache revalidated)
38 silly fetch manifest vue@>= 2.5 < 3
39 silly fetch manifest typescript@~4.1.5
40 http fetch GET 200 https://registry.npmjs.org/typescript 60ms (cache revalidated)
41 silly fetch manifest typescript@^4.4.4
42 timing idealTree Completed in 2998ms
43 timing command:install Completed in 3012ms
44 verbose stack Error: could not resolve
44 verbose stack     at PlaceDep.failPeerConflict (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:544:25)
44 verbose stack     at PlaceDep.place (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:197:21)
44 verbose stack     at new PlaceDep (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:71:10)
44 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:944:31
44 verbose stack     at Array.map (<anonymous>)
44 verbose stack     at Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:944:8)
44 verbose stack     at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:216:7)
44 verbose stack     at async Promise.all (index 1)
44 verbose stack     at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:149:5)
44 verbose stack     at async Install.install (C:\Program Files\nodejs\node_modules\npm\lib\install.js:170:5)
45 verbose cwd C:\Users\me\Repositories\repo
46 verbose Windows_NT 10.0.19042
47 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "pinia"
48 verbose node v16.13.0
49 verbose npm  v8.1.0
50 error code ERESOLVE
51 error ERESOLVE could not resolve
52 error
53 error While resolving: [1mrepo[22m@[1m0.0.0-development[22m
53 error Found: [1mvue[22m@[1m3.2.22[22m[2m[22m
53 error [2mnode_modules/vue[22m
53 error   peerOptional [1mvue[22m@"[1m^2 || ^3.0.0-0[22m" from [1m@vue/babel-preset-app[22m@[1m4.5.15[22m[2m[22m
53 error   [2mnode_modules/@vue/babel-preset-app[22m
53 error     [1m@vue/babel-preset-app[22m@"[1m^4.5.15[22m" from [1m@vue/cli-plugin-babel[22m@[1m4.5.15[22m[2m[22m
53 error     [2mnode_modules/@vue/cli-plugin-babel[22m
53 error       [33mdev[39m [1m@vue/cli-plugin-babel[22m@"[1m~4.5.0[22m" from the root project
53 error   [35mpeer[39m [1mvue[22m@"[1m3.2.22[22m" from [1m@vue/server-renderer[22m@[1m3.2.22[22m[2m[22m
53 error   [2mnode_modules/@vue/server-renderer[22m
53 error     [1m@vue/server-renderer[22m@"[1m3.2.22[22m" from [1mvue[22m@[1m3.2.22[22m
53 error   5 more (@vue/test-utils, primevue, vue-jest, vue-router, the root project)
53 error
53 error Could not resolve dependency:
53 error [1mpinia[22m@"[1m*[22m" from the root project
53 error
53 error Conflicting peer dependency: [1mvue[22m@[1m3.2.23[22m[2m[22m
53 error [2mnode_modules/vue[22m
53 error   [35mpeer[39m [1mvue[22m@"[1m>= 2.5 < 3[22m" from [1m@vue/composition-api[22m@[1m1.4.0[22m[2m[22m
53 error   [2mnode_modules/@vue/composition-api[22m
53 error     peerOptional [1m@vue/composition-api[22m@"[1m^1.4.0[22m" from [1mpinia[22m@[1m2.0.4[22m[2m[22m
53 error     [2mnode_modules/pinia[22m
53 error       [1mpinia[22m@"[1m*[22m" from the root project
53 error
53 error Fix the upstream dependency conflict, or retry
53 error this command with --force, or --legacy-peer-deps
53 error to accept an incorrect (and potentially broken) dependency resolution.
53 error
53 error See C:\Users\me\AppData\Local\npm-cache\eresolve-report.txt for a full report.
54 verbose exit 1

Additional information

Based on https://github.com/posva/pinia/issues/724#issuecomment-944964417 I think it points to the correct url ( https://registry.npmjs.org/pinia )

Based on https://github.com/posva/pinia/discussions/727#discussioncomment-1493365 I think there is no @vue/compositon-api package installed. I tested npm remove @vue/composition-api too.

matthiashermsen avatar Nov 29 '21 10:11 matthiashermsen

Using --legacy-peer-deps, npm 7, yarn, or pnpm should work as a workaround. I found https://github.com/npm/cli/issues/4104 which could be related. Any help on this is appreciated!

Edit: Apparently, this is okay from npm perspective and they expect users to use overrides to pin the vue version

posva avatar Dec 01 '21 08:12 posva

@posva I used npm install -g npm@7 to downgrade my npm version to v7.24.2 but that didn't help.

Running npm install pinia --legacy-peer-deps works but that could be dangerous in the future, no?

matthiashermsen avatar Dec 01 '21 09:12 matthiashermsen

Well, the hope would be that this gets fixed in npm in the not too distant future ...

LinusBorg avatar Dec 01 '21 12:12 LinusBorg

@matthiashermsen it is a npm bug. One way of entirely circumventing it would be to use yarn install && yarn add pinia instead of npm i && npm i pinia.

Problem solved.

andrei-gheorghiu avatar Dec 07 '21 07:12 andrei-gheorghiu

Same on Mac (MacBook Pro (13-inch, M1, 2020), macOS Monterey)

awacode@awacode-MBP13 nuxt3-bivignano % npm install pinia @pinia/nuxt
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@"3.2.26" from @nuxt/[email protected]
npm ERR!   node_modules/@nuxt/vite-builder
npm ERR!     @nuxt/vite-builder@"npm:@nuxt/[email protected]" from [email protected]
npm ERR!     node_modules/nuxt3
npm ERR!       dev nuxt3@"^3.0.0-27338323.1e98259" from the root project
npm ERR!   peer vue@"3.2.26" from @nuxt/[email protected]
npm ERR!   node_modules/@nuxt/webpack-builder
npm ERR!     @nuxt/webpack-builder@"npm:@nuxt/[email protected]" from [email protected]
npm ERR!     node_modules/nuxt3
npm ERR!       dev nuxt3@"^3.0.0-27338323.1e98259" from the root project
npm ERR!   5 more (@vitejs/plugin-vue, @vue/server-renderer, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @pinia/nuxt@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 2.5 < 3" from @vue/[email protected]
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.4.0" from [email protected]
npm ERR!     node_modules/pinia
npm ERR!       pinia@"*" from the root project
npm ERR!       1 more (@pinia/nuxt)
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/awacode/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/awacode/.npm/_logs/2022-01-10T00_12_02_442Z-debug.log

awacode21 avatar Jan 10 '22 00:01 awacode21

Same here. Installation explodes with "Conflicting peer dependency: [email protected]" log

dakt avatar Jan 10 '22 20:01 dakt

Using the latest node, npm and Vue cli version doesn't solve the issue.

But when moving to Vite by setting up the project via npm init vue@latest solved the issue for me :)

matthiashermsen avatar Feb 09 '22 08:02 matthiashermsen

Current package.json:

{ "name": "web", "version": "0.1.0", "private": true, "engines": { "node": ">=16.0.0 <17.0.0", "npm": ">=8.0.0 <9.0.0" }, "engineStrict": true, "scripts": { "config": "npm exec -- vue config", "development": "npm exec -- nodenv --env configs/.env.development --exec npm -- exec -- vue-cli-service serve", "dev": "npm run development", }, "dependencies": { "@auth0/auth0-spa-js": "1.20.0", "core-js": "^3.6.5", "logrocket": "2.2.0", "rollbar": "2.24.0", "vue": "^3.0.0", "vue-router": "^4.0.0-0" }, "devDependencies": { "@types/auth0": "2.34.13", "@types/jest": "24.9.1", "@typescript-eslint/eslint-plugin": "^4.18.0", "@typescript-eslint/parser": "^4.18.0", "@vue/cli": "4.5.15", "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-e2e-cypress": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-typescript": "~4.5.0", "@vue/cli-plugin-unit-jest": "~4.5.0", "@vue/cli-plugin-vuex": "~4.5.0", "@vue/cli-service": "~4.5.0", "@vue/compiler-sfc": "^3.0.0", "@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-typescript": "^7.0.0", "@vue/test-utils": "^2.0.0-0", "eslint": "^6.7.2", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-vue": "^7.0.0", "firebase-tools": "10.1.0", "node-env-run": "4.0.2", "prettier": "^2.2.1", "sass": "^1.26.5", "sass-loader": "^8.0.2", "typescript": "~4.1.5", "vue-jest": "^5.0.0-0" } } Error when installing:

$ npm install --save-exact pinia npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: [email protected] npm ERR! node_modules/typescript npm ERR! peer typescript@">=2" from @vue/[email protected] npm ERR! node_modules/@vue/cli-plugin-typescript npm ERR! dev @vue/cli-plugin-typescript@"~4.5.0" from the root project npm ERR! typescript@"~4.1.5" from @vue/[email protected] npm ERR! node_modules/@vue/cli-ui npm ERR! @vue/cli-ui@"^4.5.15" from @vue/[email protected] npm ERR! node_modules/@vue/cli npm ERR! dev @vue/cli@"4.5.15" from the root project npm ERR! 6 more (ts-loader, tslint, tsutils, tsutils, vue-jest, the root project) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peerOptional typescript@">=4.4.4" from [email protected] npm ERR! node_modules/pinia npm ERR! pinia@"" from the root project npm ERR! npm ERR! Conflicting peer dependency: [email protected] npm ERR! node_modules/typescript npm ERR! peerOptional typescript@">=4.4.4" from [email protected] npm ERR! node_modules/pinia npm ERR! pinia@"" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See C:\Users\karl\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\karl\AppData\Local\npm-cache_logs\2022-02-19T15_57_58_659Z-debug.log $ node -v v16.13.1

$ npm -v 8.1.2

Installed vue via the Vue CLI.

Also Am I supposed to remove Vuex manually?

basickarl avatar Feb 20 '22 11:02 basickarl

getting the same error on a fresh nuxt 3 installation. tried all the workarounds above to no avail

KeentGG avatar Feb 28 '22 16:02 KeentGG

npm install --legacy-peer-deps pinia

seems to work now.

bartenra avatar Mar 01 '22 08:03 bartenra

As @andrei-gheorghiu commented using yarn install && yarn add pinia works using node v16.14.0 and yarn v1.22.17

cifuentesmx avatar Mar 02 '22 14:03 cifuentesmx

Same issue here:

Attaching to the-hub-nuxt-1
the-hub-nuxt-1  | npm ERR! code ERESOLVE
the-hub-nuxt-1  | npm ERR! ERESOLVE could not resolve
the-hub-nuxt-1  | npm ERR! 
the-hub-nuxt-1  | npm ERR! While resolving: [email protected]
the-hub-nuxt-1  | npm ERR! Found: [email protected]
the-hub-nuxt-1  | npm ERR! node_modules/vue
the-hub-nuxt-1  | npm ERR!   peer vue@"^3.2.0" from @headlessui/[email protected]
the-hub-nuxt-1  | npm ERR!   node_modules/@headlessui/vue
the-hub-nuxt-1  | npm ERR!     @headlessui/vue@"^1.6.0" from the root project
the-hub-nuxt-1  | npm ERR!   peer vue@">= 3" from @heroicons/[email protected]
the-hub-nuxt-1  | npm ERR!   node_modules/@heroicons/vue
the-hub-nuxt-1  | npm ERR!     @heroicons/vue@"^1.0.6" from the root project
the-hub-nuxt-1  | npm ERR!   1 more (nuxt)
the-hub-nuxt-1  | npm ERR! 
the-hub-nuxt-1  | npm ERR! Could not resolve dependency:
the-hub-nuxt-1  | npm ERR! pinia@"^2.0.14" from the root project
the-hub-nuxt-1  | npm ERR! 
the-hub-nuxt-1  | npm ERR! Conflicting peer dependency: [email protected]
the-hub-nuxt-1  | npm ERR! node_modules/vue
the-hub-nuxt-1  | npm ERR!   peer vue@">= 2.5 < 3" from @vue/[email protected]
the-hub-nuxt-1  | npm ERR!   node_modules/@vue/composition-api
the-hub-nuxt-1  | npm ERR!     peerOptional @vue/composition-api@"^1.4.0" from [email protected]
the-hub-nuxt-1  | npm ERR!     node_modules/pinia
the-hub-nuxt-1  | npm ERR!       pinia@"^2.0.14" from the root project
the-hub-nuxt-1  | npm ERR! 
the-hub-nuxt-1  | npm ERR! Fix the upstream dependency conflict, or retry
the-hub-nuxt-1  | npm ERR! this command with --force, or --legacy-peer-deps
the-hub-nuxt-1  | npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
the-hub-nuxt-1  | npm ERR! 
the-hub-nuxt-1  | npm ERR! See /root/.npm/eresolve-report.txt for a full report.
the-hub-nuxt-1  | 
the-hub-nuxt-1  | npm ERR! A complete log of this run can be found in:
the-hub-nuxt-1  | npm ERR!     /root/.npm/_logs/2022-05-17T08_29_57_654Z-debug-0.log
the-hub-nuxt-1 exited with code 1

Imo this asks for a package for vue3 only.

Pinia 2.0 for Vue 2 Pinia 3.0 for Vue 3

Makes more sense to avoid these issues imo!

michtio avatar May 17 '22 08:05 michtio

As an update tho if you specifically mention that you want to use Vue 3 in your dependencies, it all installs without issues:

"dependencies": {
    "@headlessui/vue": "^1.6.0",
    "@heroicons/vue": "^1.0.6",
    "@nuxt/kit": "npm:@nuxt/kit-edge@latest",
    "@nuxtjs/axios": "^5.13.6",
    "@pinia/nuxt": "^0.1.9",
    "nuxt-graphql-client": "^0.0.30",
    "pinia": "^2.0.14",
    "vue": "^3.2.33"
  },

michtio avatar May 17 '22 09:05 michtio

If using nuxt3, we still need to install Vue3 in order to get Pinia to successfully install?

dosstx avatar Jun 01 '22 10:06 dosstx

Same terminal error here:

npm install pinia
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 3.0.0 < 4" from @fortawesome/[email protected]
npm ERR!   node_modules/@fortawesome/vue-fontawesome
npm ERR!     @fortawesome/vue-fontawesome@"^3.0.0-5" from the root project
npm ERR!   peer vue@"3.1.5" from @vue/[email protected]
npm ERR!   node_modules/@vue/compiler-sfc
npm ERR!     peer @vue/compiler-sfc@"^3.0.8" from @vitejs/[email protected]
npm ERR!     node_modules/@vitejs/plugin-vue
npm ERR!       dev @vitejs/plugin-vue@"^1.2.3" from the root project
npm ERR!     dev @vue/compiler-sfc@"^3.1.1" from the root project
npm ERR!   2 more (vue-router, the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! pinia@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@"^2.6.14 || ^3.2.0" from [email protected]
npm ERR!   node_modules/pinia
npm ERR!     pinia@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\YFH_T\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\YFH_T\AppData\Local\npm-cache\_logs\2022-06-27T09_32_43_551Z-debug-0.log

Reproduction

  • OS: Win10
  • node: v16.15.0
  • npm: v8.5.5
  • vite: 2.3.8
  • vue: 3.1.1

YuuuFen avatar Jun 27 '22 09:06 YuuuFen

Confirming had the same issue with [email protected] with only tailwind and headless as dep. Install of pinia failed due to [email protected] peer dependency.
Solution was to install vue@latest as dependency and on re-running pinia install, success. Prefer this method rather than to use force flag or otherwise hardcode peer dependencies override. Thx @michtio .

Maximus1000 avatar Jul 29 '22 16:07 Maximus1000

Hello, My initial package.json looked like: "dependencies": { "vue": "3", "pinia": "2" } and I got the same error.

I applied the following changes (as inidcated by @posva earlier in the discussion):

  • npm version >= 8
  • in package.json pin the vue version : "overrides": { "vue": "3" }, and it simply works.

costingeana avatar Aug 02 '22 07:08 costingeana

I didn't see this issue, I'm sorry @posva, I actually searched a lot on this repo but I guess I used the wrong keywords. Time wasting bothers us users too, you can easily imagine I spent quite some time to get the reproduction done right, having in mind devs' time.

lucavenir avatar Aug 10 '22 10:08 lucavenir

Somehow, I'm having to install Vue 3 on Nuxt 3.rc.9 to fix it, which is no big deal but can be quite frustrating for clueless newcomers. Hopefully, this will be fixed soon.

ZiadJ avatar Sep 10 '22 12:09 ZiadJ

I also face this problem. I solved this issue when installed vue3 with pinia in nuxt3. npm i vue@latest pinia @pinia/nuxt

mu-aqib avatar Sep 14 '22 16:09 mu-aqib

I am also facing this problem in fresh nuxt rc.11 installations.

nurRiyad avatar Sep 21 '22 10:09 nurRiyad

Same for me when using Nuxt 3 rc11. But it works with the "overrides": { "vue": "3" }, workaround in package.json.

maxdzin avatar Sep 21 '22 10:09 maxdzin

Same issue here - not sure what would be the best "fix" that wouldn't affect anything else

kosmeln avatar Sep 22 '22 09:09 kosmeln

@kosmeln @maxdzin @nurRiyad

As written above, this is an npm-related issue: there are no dependency conflicts going on.

Just run npm i -D vue@latest before running npm i -D pinia @pinia/nuxt.

This means having vue as a dev dependency within your Nuxt3 project. This may feel absurd, as Nuxt3's dev dependencies obviously already expose the latest version of Vue3, but adding that line inside package.json allows you to avoid the wrongly perceived dependency conflicts.

Just to be 100% clear, here's my package.json dependencies on a full working small personal project:

{
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "devDependencies": {
    "@nuxtjs/eslint-config-typescript": "^11.0.0",
    "@nuxtjs/tailwindcss": "^5.3.3",
    "@pinia/nuxt": "^0.4.2",
    "@vueuse/core": "^9.2.0",
    "@vueuse/nuxt": "^9.2.0",
    "eslint": "^8.23.1",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-nuxt": "^4.0.0",
    "eslint-plugin-prettier": "^4.2.1",
    "nuxt": "3.0.0-rc.10",
    "pinia": "^2.0.20",
    "vue": "^3.2.39",
    "@nuxt/test-utils-edge": "^3.0.0-rc.11-27722063.c1ed6ec",
    "vitest": "^0.23.2"
  }
}

You can copy / paste this if anything goes wrong and just run npm install afterwards.

lucavenir avatar Sep 22 '22 10:09 lucavenir

I had the same issue with packages such as vuelidate or vue-leaflet. Simply adding "vue": "^3.2.39" to my package.json and restarting npm install fixed it, as mentioned by @lucavenir.

But npm warnings are still showing on each install, any ideas how to remove them ?

lacorde avatar Sep 30 '22 11:09 lacorde

Just to share how I ended up here, if it can help others.

I didn't have any trouble installing pinia and @pinia/nuxt but conflicting dependencies came when I tried to install @vuepic/vue-datepicker

While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@">=3.2.0" from @vuepic/[email protected]
npm ERR!   node_modules/@vuepic/vue-datepicker
npm ERR!     @vuepic/vue-datepicker@"*" from the root project
npm ERR!   vue@"^3.2.39" from [email protected]
npm ERR!   node_modules/nuxt
npm ERR!     dev nuxt@"3.0.0-rc.11" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! pinia@"^2.0.23" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vue
npm ERR!   peer vue@">= 2.5 < 2.7" from @vue/[email protected]
npm ERR!   node_modules/@vue/composition-api
npm ERR!     peerOptional @vue/composition-api@"^1.4.0" from [email protected]
npm ERR!     node_modules/pinia
npm ERR!       pinia@"^2.0.23" from the root project

I reckon because one is asking for a version after 3.2 and the other one for a version before 2.7 Installing vue in my dependencies fixed the npm i but I would like to understand why pinia is forcing this old version? (If I understood the log correctly)

Thanks for your work!

cdefy avatar Oct 13 '22 05:10 cdefy

Well, the hope would be that this gets fixed in npm in the not too distant future ...

10 months... Is it the distant future yet? :D

AloisSeckar avatar Oct 20 '22 11:10 AloisSeckar

Any news on that ? I can't even run boilerplate code meaning basic nuxt3 quickstart code with 1 simple pinia store.

Fbartoli avatar Nov 20 '22 10:11 Fbartoli

@Fbartoli read the above comments to make it work. It's a silly npm error.

lucavenir avatar Nov 20 '22 17:11 lucavenir

Any news on that ? I can't even run boilerplate code meaning basic nuxt3 quickstart code with 1 simple pinia store.

just add "overrides": { "vue": 3 } into package.json and re-run npm install, works like charm in all my current Nuxt 3 projects

AloisSeckar avatar Nov 20 '22 21:11 AloisSeckar

just add "overrides": { "vue": 3 } into package.json and re-run npm install, works like charm in all my current Nuxt 3 projects

So, this "works like charm" solution stopped working for me now with pinia 2.0.27. But just a slight modification helped:

"overrides": { 
    "vue": "latest"
}

AloisSeckar avatar Nov 27 '22 16:11 AloisSeckar