I have a project which runs on Vue 3 and I am trying to install vue-datepicker.
But it fails to install the module and I can see the following error.
npm install @vuepic/vue-datepicker
npm notice
npm notice New minor version of npm available! 8.1.2 -> 8.5.5
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.5.5
npm notice Run npm install -g npm@8.5.5 to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: myproject-spa@1.1.0
npm ERR! Found: vue@3.0.11
npm ERR! node_modules/vue
npm ERR! peerOptional vue@"^2.6.10 || ^3.0.0" from @storybook/addon-docs@6.4.0-alpha.18
npm ERR! node_modules/@storybook/addon-essentials/node_modules/@storybook/addon-docs
npm ERR! @storybook/addon-docs@"6.4.0-alpha.18" from @storybook/addon-essentials@6.4.0-alpha.18
npm ERR! node_modules/@storybook/addon-essentials
npm ERR! dev @storybook/addon-essentials@"^6.4.0-alpha.18" from the root project
npm ERR! peer vue@"^3.0.0" from @storybook/vue3@6.4.0-alpha.18
npm ERR! node_modules/@storybook/vue3
npm ERR! peerOptional @storybook/vue3@"6.4.0-alpha.18" from @storybook/addon-docs@6.4.0-alpha.18
npm ERR! node_modules/@storybook/addon-essentials/node_modules/@storybook/addon-docs
npm ERR! @storybook/addon-docs@"6.4.0-alpha.18" from @storybook/addon-essentials@6.4.0-alpha.18
npm ERR! node_modules/@storybook/addon-essentials
npm ERR! dev @storybook/addon-essentials@"^6.4.0-alpha.18" from the root project
npm ERR! dev @storybook/vue3@"^6.4.0-alpha.18" from the root project
npm ERR! 9 more (@vue/babel-preset-app, @vue/compiler-sfc, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @vuepic/vue-datepicker@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue@3.2.31
npm ERR! node_modules/vue
npm ERR! peer vue@">=3.2.0" from @vuepic/vue-datepicker@3.0.0
npm ERR! node_modules/@vuepic/vue-datepicker
npm ERR! @vuepic/vue-datepicker@"*" 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!
...
After that, I tried to use --legacy-peer-deps while installing the module, it seems that the module was successfully installed without an error, but I can't use the module due to the import error.
18 | import Datepicker from '@vuepic/vue-datepicker'
| ^^^^^^^^^^^^^^^^^^^^^^^^
How can I fix this or resolve the module dependencies?
I am on node 16.14.0, npm 8.3.1 and ubuntu 20.
