i cant install vue-router by npm - vue.js

i want to install vue-router but some errors occurs
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: routing01#1.0.0
npm ERR! Found: vue#2.6.14
npm ERR! node_modules/vue
npm ERR! vue#"^2.5.11" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.2.0" from vue-router#4.0.15
npm ERR! node_modules/vue-router
npm ERR! vue-router#"4" 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\Peyman\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\Peyman\AppData\Local\npm-cache\_logs\2022-05-31T07_48_48_170Z-debug-0.log

The problem is you have incompatible versions of vue and vue-router.
vue#2 requires vue-router#3
vue#3 requires vue-router#4
The error message indicates you have vue#2.6.14, and you're trying to install vue-router#4.0.15. Note that npm install -S vue-router (without a version specifier) defaults to the latest version, which is currently 4.0.15.
Don't use the --force or --legacy-peer-deps npm flags that are suggested in the error message because that would only install incompatible packages that would result in a runtime error.
Solution
A quick fix is to install vue-router#3:
npm install -S vue-router#3
Or you can upgrade to Vue 3, which requires uninstalling vue-template-compiler (the template compiler for Vue 2) and installing #vue/compiler-sfc (the template compiler for Vue 3):
npm uninstall -S vue-template-compiler
npm install -S vue#3 #vue/compiler-sfc

you can add by using plugin also using vue-cli.
try vue add router
btw use can install vuetify and eslint and many more things using vue add vuetify and vue add eslint
you can refer this: https://cli.vuejs.org/guide/plugins-and-presets.html#plugins

Try -
npm install --save --legacy-peer-deps
This command will tell npm to ignore peer dependencies

Related

Fix the upstream dependency conflict, React Native Expo

I have a React Native Expo application, and I am trying to install expo-splash-screen with running npx expo install expo-splash-screen
As a result I get the following error message:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-navigation-drawer#2.7.2
npm ERR! Found: react-native-gesture-handler#2.5.0
npm ERR! node_modules/react-native-gesture-handler
npm ERR! peer react-native-gesture-handler#">= 1.0.0" from #react-navigation/drawer#6.5.0
npm ERR! node_modules/#react-navigation/drawer
npm ERR! #react-navigation/drawer#"^6.5.0" from the root project
npm ERR! peer react-native-gesture-handler#">= 1.5.0" from react-navigation-stack#2.10.4
npm ERR! node_modules/react-navigation-stack
npm ERR! react-navigation-stack#"^2.10.4" from the root project
npm ERR! 1 more (the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-gesture-handler#"^1.0.12" from react-navigation-drawer#2.7.2
npm ERR! node_modules/react-navigation-drawer
npm ERR! react-navigation-drawer#"^2.7.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react-native-gesture-handler#1.10.3
npm ERR! node_modules/react-native-gesture-handler
npm ERR! peer react-native-gesture-handler#"^1.0.12" from react-navigation-drawer#2.7.2
npm ERR! node_modules/react-navigation-drawer
npm ERR! react-navigation-drawer#"^2.7.2" 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.
While running npm -v react-native-gessture-handler it says: 8.15.0.
I have also tried using npm i react-native-splash-screen --force but it is not good for an expo application, and I am pretty sure that installing react-navigation-drawer with --force resulted the problem.
I am not really experienced with package managing so I do not really get the point of the error message. How can I install expo-splash-screen, and can somebody explain the error message?
It looks you have libraries that use different versions of react-native-gesture-handler. react-navigation-drawer is using and older react-native-gesture-handler version and this package is deprecated so you cannot update it to use a higher version of react-native-gesture-handler.
The best solution in my opinion is to change the package react-navigation-drawer to #react-navigation/drawer as it says in the documentation of the package.
The other alternative but at your own risk is to specify in the package.json a resolution with the react-native-gesture-handler you need in expo-splash-screen and every library that have as peer dependecy react-native-gesture-handler will use this specific version.
"resolutions": {
"react-native-gesture-handler": "x.x.x"
}
Let me know if it helps

TypeError: Object(...) is not a function when trying to import VueRouter [duplicate]

i want to install vue-router but some errors occurs
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: routing01#1.0.0
npm ERR! Found: vue#2.6.14
npm ERR! node_modules/vue
npm ERR! vue#"^2.5.11" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.2.0" from vue-router#4.0.15
npm ERR! node_modules/vue-router
npm ERR! vue-router#"4" 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\Peyman\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\Peyman\AppData\Local\npm-cache\_logs\2022-05-31T07_48_48_170Z-debug-0.log
The problem is you have incompatible versions of vue and vue-router.
vue#2 requires vue-router#3
vue#3 requires vue-router#4
The error message indicates you have vue#2.6.14, and you're trying to install vue-router#4.0.15. Note that npm install -S vue-router (without a version specifier) defaults to the latest version, which is currently 4.0.15.
Don't use the --force or --legacy-peer-deps npm flags that are suggested in the error message because that would only install incompatible packages that would result in a runtime error.
Solution
A quick fix is to install vue-router#3:
npm install -S vue-router#3
Or you can upgrade to Vue 3, which requires uninstalling vue-template-compiler (the template compiler for Vue 2) and installing #vue/compiler-sfc (the template compiler for Vue 3):
npm uninstall -S vue-template-compiler
npm install -S vue#3 #vue/compiler-sfc
you can add by using plugin also using vue-cli.
try vue add router
btw use can install vuetify and eslint and many more things using vue add vuetify and vue add eslint
you can refer this: https://cli.vuejs.org/guide/plugins-and-presets.html#plugins
Try -
npm install --save --legacy-peer-deps
This command will tell npm to ignore peer dependencies

Install Pinia with Quasar v2

I'm using Quasar v2, Vue 3 and I'm trying to install Pinia.
Whenever I try to run: npm install pinia or also npm install pinia#next,
it gives me this error:
code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ui#0.0.1
npm ERR! Found: vue#3.1.5
npm ERR! node_modules/vue
npm ERR! vue#"3.1.5" from #quasar/app#3.0.4
npm ERR! node_modules/#quasar/app
npm ERR! dev #quasar/app#"^3.0.4" from the root project
npm ERR! peer vue#"3.1.5" from #vue/compiler-sfc#3.1.5
npm ERR! node_modules/#vue/compiler-sfc
npm ERR! #vue/compiler-sfc#"3.1.5" from #quasar/app#3.0.4
npm ERR! node_modules/#quasar/app
npm ERR! dev #quasar/app#"^3.0.4" from the root project
npm ERR! peerOptional #vue/compiler-sfc#"^3.0.8" from vue-loader#16.4.1
npm ERR! node_modules/vue-loader
npm ERR! vue-loader#"16.4.1" from #quasar/app#3.0.4
npm ERR! node_modules/#quasar/app
npm ERR! dev #quasar/app#"^3.0.4" from the root project
npm ERR! 5 more (#vue/server-renderer, #vue/test-utils, vue-i18n, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! pinia#"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue#2.6.14
npm ERR! node_modules/vue
npm ERR! peer vue#"^2.6.14 || ^3.2.0" from pinia#2.0.2
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 /home/gii/.npm/eresolve-report.txt for a full report.
Does anyone know how to make this work?
Moreover, since I'm using Typescript, is there a way to configure it already with it via this initial npm command?
You can install Pinia if you remove Vuex first.
Just delete Vuex from your package.json and then you are free to install Pinia.
Faced the same problem while installing pinia from npm having vuex configured in my vue3 app , after couple of try i uninstalled vuex and reinstalled pinia and then it worked fine
If you just want to get everything installed and are not concerned about possibly running incompatible versions: npm install --legacy-peer-deps.
Beyond that, your options get much more involved. You can try updating everything and cross your fingers that all the most up-to-date versions are compatible with each other. You can downgrade dependencies that require newer versions of peer dependencies. And so on.

"ERESOLVE unable to resolve dependency tree" when setting up a new project using wdio-v7

I am trying to set up a new project using wdio-v7,
firstly I ran npm init -y
then npm install #wdio/cli --save-dev
and after running npx wdio config -y I receive this:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: example-test#1.0.0
npm ERR! Found: #wdio/cli#7.0.5
npm ERR! node_modules/#wdio/cli
npm ERR! dev #wdio/cli#"^7.0.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #wdio/cli#"^6.0.0" from wdio-chromedriver-service#6.0.4
npm ERR! node_modules/wdio-chromedriver-service
npm ERR! dev wdio-chromedriver-service#"*" 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!
Initialize WebdriverIO and setup configuration in your current project.
Documentation: https://webdriver.io
#wdio/cli (v7.0.5)
I tried using --force, or --legacy-peer-deps but unsuccessful.
That is weird, looks like npx wdio config -yis trying to install older version of chrome driver service.
Try to manually install chromedriver service or update the version in package.json
"wdio-chromedriver-service": "^7.0.0"
Make sure you have the min requirements by webdriverio
https://webdriver.io/docs/gettingstarted#system-requirements
Install at least v12.16.1 or higher as this is the oldest active LTS
version Only releases that are or will become an LTS release are
officially supported

Installing styled components failed in react native

I'm using react native 0.63.4 and react 16.13.1.
I try to install 'styled-components' with
npm install --save styled-components
and failed with these messages:
`code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: myproject#0.0.1
npm ERR! Found: react#16.13.1
npm ERR! node_modules/react
npm ERR! react#"16.13.1" from the root project
npm ERR! peer react#">= 16.8.0" from styled-components#5.2.1
npm ERR! node_modules/styled-components
npm ERR! styled-components#"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.1" from react-dom#17.0.1
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#">= 16.8.0" from styled-components#5.2.1
npm ERR! node_modules/styled-components
npm ERR! styled-components#"*" 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! `
I was not sure what the problems are.
Please if anyone can help me. Thanks.
UPDATE
https://github.com/npm/cli/issues/2120
Also there is a issue with npm resolving peer-dependencies, npm-CLI currently breaks standard NPM7 installs of several major dependencies, such as for example styled-component, your npm version is 7.+ also
Try downgrading to npm 6 or install another version of styled-components
or you can use yarn to install styled-components
yarn add styled-components
I ended up using yarn to instal styled-components, and it works.
yarn add styled-components
Have you tried using yarn instead of npm?