Unable to resolve dependency tree - React Native Expo - react-native

I have been starting my story with React Native (Expo). Someday I needed to install datetimepicker. Unfortunately, I have done something wrong. I tried to face the problem by myself. I removed the node_modeles directory and package.lock.json. When I trying to npm install I get the error below:
error message
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
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.3" from #react-native-community/datetimepicker#3.4.6
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"^3.0.4" from the root project
npm ERR! 1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.1" from react-native-windows#0.64.3
npm ERR! node_modules/react-native-windows
npm ERR! peer react-native-windows#">=0.62" from #react-native-community/datetimepicker#3.4.6
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"^3.0.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.
I know that is something with the wrong versions of dependencies but I have no idea how to fixed it :(
That is my package.json.
UPDATED package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#react-native-async-storage/async-storage": "^1.13.0",
"#react-native-picker/picker": "1.9.11",
"#react-navigation/bottom-tabs": "^5.11.10",
"#react-navigation/drawer": "^5.12.5",
"#react-navigation/native": "^5.9.4",
"#react-navigation/stack": "^5.14.4",
"#types/expo__vector-icons": "^9.0.1",
"expo": "~41.0.0",
"expo-app-loading": "^1.0.3",
"expo-notifications": "~0.11.5",
"expo-sms": "~9.1.2",
"expo-status-bar": "~1.0.4",
"i18n-js": "^3.8.0",
"moment": "^2.29.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz",
"react-native-gesture-handler": "~1.10.2",
"react-native-pager-view": "5.0.12",
"react-native-reanimated": "~1.13.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.0.0",
"react-native-tab-view": "^3.0.1",
"react-native-web": "^0.13.18",
"react-native-webview": "11.2.3",
"react-navigation-header-buttons": "^7.0.1",
"react-redux": "^7.2.3",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"#types/i18n-js": "^3.8.0",
"#types/react": "~16.9.35",
"#types/react-dom": "^17.0.3",
"#types/react-native": "~0.63.2",
"#types/react-redux": "^7.1.16",
"typescript": "~4.0.0"
},
"private": true
}
How can I make it working again?
UPDATE #1
I have created a new project and I have installed all dependencies by expo install without react-native-modal-datetime-picker. I have copied and dependencies to my original project. When I used npm install my project installed correctly with the message:
22:39 $ npm install
npm WARN deprecated deep-assign#3.0.0: Check out `lodash.merge` or `merge-options` instead.
npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated uglify-es#3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated #hapi/joi#15.1.1: Switch to 'npm install joi'
npm WARN deprecated core-js#1.2.7: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
added 1087 packages, and audited 1088 packages in 30s
60 packages are looking for funding
run `npm fund` for details
12 low severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Right now I'm trying to install react-native-modal-datetime-picker (https://github.com/mmazzarolo/react-native-modal-datetime-picker) and I'm getting error:
22:44 $ expo install react-native-modal-datetime-picker #react-native-community/datetimepicker
Installing 1 SDK 41.0.0 compatible native module and 1 other package using npm.
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
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.3" from #react-native-community/datetimepicker#3.2.0
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"3.2.0" from the root project
npm ERR! 1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.1" from react-native-windows#0.64.3
npm ERR! node_modules/react-native-windows
npm ERR! peer react-native-windows#">=0.62" from #react-native-community/datetimepicker#3.2.0
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"3.2.0" 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/adas/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/adas/.npm/_logs/2021-04-17T20_53_05_643Z-debug.log
npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
at ChildProcess.completionListener (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/#expo/spawn-async/src/spawnAsync.ts:65:13)
at Object.onceWrapper (events.js:422:26)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:467:12)
at maybeClose (internal/child_process.js:1048:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
...
at Object.spawnAsync [as default] (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/#expo/spawn-async/src/spawnAsync.ts:26:19)
at NpmPackageManager._runAsync (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/#expo/package-manager/src/NodePackageManagers.ts:166:31)
at NpmPackageManager.addAsync (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/#expo/package-manager/src/NodePackageManagers.ts:105:18)
at installAsync (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/src/commands/install.ts:130:3)
at Command.<anonymous> (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/src/exp.ts:349:7)

Try Updating packages to the latest version.
npm update
give a try to install with --force flag as well if the update has not worked. eg:
npm install --force

try running this:
npm install --legacy-peer-deps --global expo-cli

Related

How to add Jest-React testing library to Expo

I'm trying to install Jest and React testing library to my expo project(sdk 47). While installing i'm getting dependency conflict. i'm new to testing can you please help me how to install
Found: react#18.1.0 npm ERR! node_modules/react npm ERR!
react#"18.1.0" from the root project npm ERR! peer react#">=16.0.0"
from #testing-library/react-native#11.5.0 npm ERR!
node_modules/#testing-library/react-native npm ERR!
#testing-library/react-native#"" from the root project npm ERR! 1
more (react-native) npm ERR! npm ERR! Could not resolve dependency:
npm ERR! peer react#"^18.2.0" from react-test-renderer#18.2.0 npm ERR!
node_modules/react-test-renderer npm ERR!
react-test-renderer#"^18.1.0" from the root project npm ERR! peer
react-test-renderer#">=16.0.0" from
#testing-library/react-native#11.5.0 npm ERR!
node_modules/#testing-library/react-native npm ERR!
#testing-library/react-native#"" 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\rikvitha\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\rikvitha\AppData\Local\npm-cache_logs\2023-01-22T05_28_56_533Z-debug-0.log
Are you trying to install React testing library (RTL), or React-Native testing library (RNTL)? Your question say one thing, but your error logs the other, they are two distinct libraries. I am going to assume it's RNTL, because your also using expo.
The error log says that you have several dependencies that are in conflict with each other, i.e. you have a dependency conflict. What I would recommend is to remove the dependencies and add them again (if you have a commit where everything worked, you can do git reset head --hard to throw away your changes). I think your problem is with react-test-renderer, but dependency conflicts are tricky.
These are the versions I use:
"#testing-library/jest-native": "^5.4.1",
"#testing-library/react-native": "^11.5.0",
"#tsconfig/react-native": "^2.0.2",
"#types/jest": "^26.0.24",
"#types/react": "^18.0.21",
"#types/react-native": "^0.70.6",
"#types/react-test-renderer": "^18.0.0",
"babel-jest": "^26.6.3",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "0.72.3",
"react-test-renderer": "18.1.0",
"ts-jest": "^29.0.3",
"typescript": "^4.9.4"
I use react-native (instead of expo) and typescript (instead of js), so there are a few more plugins that you probably don't need, unless your also using TS, but these versions should not conflict with each other.

How to read ERESOLVE in npm audit fix?

Here is the output I have after getting audit warnings after installing an npm package:
$ npm audit fix
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: eslint-config-standard-with-typescript#21.0.1
npm ERR! Found: #typescript-eslint/eslint-plugin#5.46.1
npm ERR! node_modules/#typescript-eslint/eslint-plugin
npm ERR! dev #typescript-eslint/eslint-plugin#"^5.46.1" from the root project
npm ERR! peerOptional #typescript-eslint/eslint-plugin#"^5.0.0" from eslint-plugin-unused-imports#2.0.0
npm ERR! node_modules/eslint-plugin-unused-imports
npm ERR! dev eslint-plugin-unused-imports#"^2.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #typescript-eslint/eslint-plugin#"^4.0.1" from eslint-config-standard-with-typescript#21.0.1
npm ERR! node_modules/eslint-config-standard-with-typescript
npm ERR! dev eslint-config-standard-with-typescript#"^21.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #typescript-eslint/eslint-plugin#4.33.0
npm ERR! node_modules/#typescript-eslint/eslint-plugin
npm ERR! peer #typescript-eslint/eslint-plugin#"^4.0.1" from eslint-config-standard-with-typescript#21.0.1
npm ERR! node_modules/eslint-config-standard-with-typescript
npm ERR! dev eslint-config-standard-with-typescript#"^21.0.1" 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!
npm ERR! For a full report see:
npm ERR! /Users/lancepollard/.npm/_logs/2023-01-02T17_19_47_490Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/lancepollard/.npm/_logs/2023-01-02T17_19_47_490Z-debug-0.log
That came after running npm audit fix --force a few times, after getting this:
$ npm install eslint-plugin-unused-imports --save-dev
added 2 packages, and audited 379 packages in 4s
107 packages are looking for funding
run `npm fund` for details
5 high severity vulnerabilities
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Any ideas what I should be doing here to resolve and get a successful install?
My package.json is:
{
"main": "./host",
"type": "module",
"scripts": {
"build": "tsc && tsc-alias",
"watch": "concurrently --kill-others \"tsc -w\" \"tsc-alias -w\"",
"lint": "eslint --ext .ts ./make",
"lint:fix": "npm run lint -- --fix",
"test": "node host/task/build"
},
"devDependencies": {
"#trivago/prettier-plugin-sort-imports": "^4.0.0",
"#types/glob": "^8.0.0",
"#types/lodash": "^4.14.191",
"#types/node": "^18.11.17",
"#typescript-eslint/eslint-plugin": "^5.46.1",
"#typescript-eslint/parser": "^5.46.1",
"concurrently": "^7.6.0",
"eslint": "^8.30.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-standard-with-typescript": "^21.0.1",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-n": "^15.6.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-simple-import-sort": "^8.0.0",
"eslint-plugin-sort-exports": "^0.8.0",
"eslint-plugin-sort-keys": "^2.3.5",
"eslint-plugin-typescript-sort-keys": "^2.1.0",
"eslint-plugin-unused-imports": "^2.0.0",
"prettier": "2.8.1",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.2",
"typescript": "^4.9.4"
},
"dependencies": {
"#lancejpollard/pretty-compact-json.js": "^0.2.0",
"chalk": "^5.2.0",
"glob": "^8.0.3",
"lodash": "^4.17.21",
"source-map": "^0.7.4"
}
}
Now I have rm -rf node_modules, and when I do npm install again, it shows the same error....
I had the same problem. Deleting the package-lock.json and the node_modules, and then running npm install solved my issue.
I hope it helps.

Why is npm install installing a different version of a package than what's specified in package.json?

I am trying to set up a Gatsby project. The package.json file clearly wants react-drag-drop-files#2.3.5 but npm install is installing version 2.3.8, which is causing a dependency issue with react#18 and react#17. I am new to Node.js so I am not completely sure if that is the real issue.
The error log:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-drag-drop-files#2.3.8
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"^17.0.1" from the root project
npm ERR! peer react#"^16.9.0 || ^17.0.0 || ^18.0.0 || ^0.0.0" from gatsby-link#4.24.1
npm ERR! node_modules/gatsby-link
npm ERR! gatsby-link#"^4.24.1" from gatsby#4.24.8
npm ERR! node_modules/gatsby
npm ERR! gatsby#"^4.6.0" from the root project
npm ERR! 12 more (babel-plugin-remove-graphql-queries, ...)
npm ERR! 30 more (gatsby, gatsby-plugin-image, gatsby-plugin-offline, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^18.0.0" from react-drag-drop-files#2.3.8
npm ERR! node_modules/react-drag-drop-files
npm ERR! react-drag-drop-files#"^2.3.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#18.2.0
npm ERR! node_modules/react
npm ERR! peer react#"^18.0.0" from react-drag-drop-files#2.3.8
npm ERR! node_modules/react-drag-drop-files
npm ERR! react-drag-drop-files#"^2.3.5" 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.
The package.json file:
"dependencies": {
"#emotion/react": "^11.7.1",
"#emotion/styled": "^11.6.0",
"#fluentui/react": "^8.51.1",
"#mui/icons-material": "^5.4.1",
"#mui/material": "^5.5.2",
"#mui/x-data-grid": "^5.7.0",
"axios": "^0.25.0",
"bootstrap-icons": "^1.7.2",
"cgview": "^1.2.0",
"gatsby": "^4.6.0",
"gatsby-plugin-gatsby-cloud": "^4.6.0",
"gatsby-plugin-image": "^2.6.0",
"gatsby-plugin-manifest": "^4.6.0",
"gatsby-plugin-offline": "^5.6.0",
"gatsby-plugin-react-helmet": "^5.6.0",
"gatsby-plugin-sharp": "^4.6.0",
"gatsby-source-filesystem": "^4.6.0",
"gatsby-transformer-sharp": "^4.6.0",
"prop-types": "^15.8.0",
"react": "^17.0.1",
"react-component-export-image": "^1.0.6",
"react-dom": "^17.0.1",
"react-drag-drop-files": "^2.3.5",
"react-helmet": "^6.1.0"
}

Unable to resolve module react-native-fs

I'm learning react native and building and app that use the camera and it works fine.
Now I'm trying to make image classification but I'm getting this error after installing:
#tensorflow/tfjs-react-native --legacy-peer-deps
I get this:
Unable to resolve module react-native-fs from
/Users/myuser/ALPR/node_modules/#tensorflow/tfjs-react-native/dist/bundle_resource_io.js:
react-native-fs could not be found within the project or in these
directories: node_modules
I don't know what should I do, I tried installing react-native-fs but I got this:
npm install react-native-fs npm ERR! code ERESOLVE npm ERR! ERESOLVE
could not resolve npm ERR! npm ERR! While resolving:
#tensorflow/tfjs-react-native#0.8.0 npm ERR! Found:
#tensorflow/tfjs-backend-cpu#3.19.0 npm ERR!
node_modules/#tensorflow/tfjs-backend-cpu npm ERR!
#tensorflow/tfjs-backend-cpu#"3.19.0" from #tensorflow/tfjs#3.19.0 npm
ERR! node_modules/#tensorflow/tfjs npm ERR!
#tensorflow/tfjs#"^3.19.0" from the root project npm ERR!
#tensorflow/tfjs-backend-cpu#"3.19.0" from
#tensorflow/tfjs-backend-webgl#3.19.0 npm ERR!
node_modules/#tensorflow/tfjs-backend-webgl npm ERR!
#tensorflow/tfjs-backend-webgl#"3.19.0" from #tensorflow/tfjs#3.19.0
npm ERR! node_modules/#tensorflow/tfjs npm ERR!
#tensorflow/tfjs#"^3.19.0" from the root project npm ERR! npm ERR!
Could not resolve dependency: npm ERR! peer
#tensorflow/tfjs-backend-cpu#"~3.11.0" from
#tensorflow/tfjs-react-native#0.8.0 npm ERR!
node_modules/#tensorflow/tfjs-react-native npm ERR!
#tensorflow/tfjs-react-native#"^0.8.0" from the root project npm ERR!
npm ERR! Conflicting peer dependency:
#tensorflow/tfjs-backend-cpu#3.11.0 npm ERR!
node_modules/#tensorflow/tfjs-backend-cpu npm ERR! peer
#tensorflow/tfjs-backend-cpu#"~3.11.0" from
#tensorflow/tfjs-react-native#0.8.0 npm ERR!
node_modules/#tensorflow/tfjs-react-native npm ERR!
#tensorflow/tfjs-react-native#"^0.8.0" 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 /Users/macmac/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in: npm ERR!
/Users/macmac/.npm/_logs/2022-08-22T12_14_25_319Z-debug-0.log
I'm using this tutorial: https://www.bam.tech/article/how-to-recognize-real-time-object-in-reactnative-for-dummies
Hopefully somebody can help me with this.
Thanks
This is the package.json
{
"name": "alpr",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"#react-native-async-storage/async-storage": "~1.17.3",
"#tensorflow/tfjs": "^3.19.0",
"#tensorflow/tfjs-react-native": "^0.8.0",
"expo": "~46.0.8",
"expo-camera": "~12.3.0",
"expo-gl": "~11.4.0",
"expo-gl-cpp": "~11.4.0",
"expo-media-library": "~14.2.0",
"expo-sharing": "~10.3.0",
"expo-status-bar": "~1.4.0",
"react": "18.0.0",
"react-native": "0.69.4"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
Finally I solved this by deleting the folder node_modules and then I used yarn install instead of npm.

npm update fails for Vue 2 project, created with vue-cli

I've created a Vue 2 project with vue-cli and tried to run npm update.
Unfortunately, I receive the following error:
{
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: test-vue#0.1.0
npm ERR! Found: vue#2.6.12
npm ERR! node_modules/vue
npm ERR! vue#"~2.6.11" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"3.0.7" from #vue/compiler-sfc#3.0.7
npm ERR! node_modules/#vue/compiler-sfc
npm ERR! peerOptional #vue/compiler-sfc#"^3.0.0-beta.14" from #vue/cli-service#4.5.11
npm ERR! node_modules/#vue/cli-service
npm ERR! dev #vue/cli-service#"~4.5.0" from the root project
npm ERR! 1 more (#vue/cli-plugin-babel)
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!
My package.json looks like this:
{
"name": "test-vue",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#turf/turf": "^6.3.0",
"bootstrap": "^4.5.3",
"core-js": "^3.6.5",
"leaflet": "^1.7.1",
"leaflet-geodesy": "^0.2.1",
"vue": "~2.6.11",
"vue-router": "~3.2.0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^6.2.2",
"prettier": "^1.19.1",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"vue-template-compiler": "~2.6.11"
}
}
I thought the ~ in the package.json should prevent from upgrading to Vue 3?
You help is appreciated!
EDIT: Tried as suggest with ncu -u
PS E:\projects\test-vue> ncu -u
Upgrading E:\projects\test-vue\package.json
[====================] 20/20 100%
core-js ^3.6.5 → ^3.9.1
vue ~2.6.11 → ~2.6.12
vue-router ~3.2.0 → ~3.5.1
#vue/cli-plugin-babel ~4.5.0 → ~4.5.11
#vue/cli-plugin-eslint ~4.5.0 → ~4.5.11
#vue/cli-plugin-router ~4.5.0 → ~4.5.11
#vue/cli-service ~4.5.0 → ~4.5.11
eslint ^6.7.2 → ^7.21.0
eslint-plugin-prettier ^3.1.3 → ^3.3.1
eslint-plugin-vue ^6.2.2 → ^7.7.0
prettier ^1.19.1 → ^2.2.1
sass ^1.26.5 → ^1.32.8
sass-loader ^8.0.2 → ^11.0.1
vue-template-compiler ~2.6.11 → ~2.6.12
Run npm install to install new versions.
PS E:\projects\test-vue> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: webpack#5.24.3
npm ERR! node_modules/webpack
npm ERR! peer webpack#"^4.0.0 || ^5.0.0" from #soda/friendly-errors-webpack-plugin#1.8.0
npm ERR! node_modules/#soda/friendly-errors-webpack-plugin
npm ERR! #soda/friendly-errors-webpack-plugin#"^1.7.1" from #vue/cli-service#4.5.11
npm ERR! node_modules/#vue/cli-service
npm ERR! dev #vue/cli-service#"~4.5.11" from the root project
npm ERR! 4 more (#vue/cli-plugin-babel, #vue/cli-plugin-eslint, ...)
npm ERR! peer webpack#">=4.0.0" from #vue/preload-webpack-plugin#1.1.2
npm ERR! node_modules/#vue/preload-webpack-plugin
npm ERR! #vue/preload-webpack-plugin#"^1.1.0" from #vue/cli-service#4.5.11
npm ERR! node_modules/#vue/cli-service
npm ERR! dev #vue/cli-service#"~4.5.11" from the root project
npm ERR! 4 more (#vue/cli-plugin-babel, #vue/cli-plugin-eslint, ...)
npm ERR! 8 more (babel-loader, copy-webpack-plugin, css-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"^4.0.0" from #intervolga/optimize-cssnano-plugin#1.0.6
npm ERR! node_modules/#intervolga/optimize-cssnano-plugin
npm ERR! #intervolga/optimize-cssnano-plugin#"^1.0.5" from #vue/cli-service#4.5.11
npm ERR! node_modules/#vue/cli-service
npm ERR! dev #vue/cli-service#"~4.5.11" from the root project
npm ERR! 4 more (#vue/cli-plugin-babel, #vue/cli-plugin-eslint, ...)
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\Admin\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\Admin\AppData\Local\npm-cache\_logs\2021-03-06T19_52_21_583Z-debug.log
maybe you can try to npm i -g npm-check-updates then in the root folder try to execute ncu -u this will update your dependencies, devDependencies and peerDependencies
There was an issue with some dependencies.
I finally worked this out by creating a new project with vue-cli and copying that package.json there.
Edit:
You have to make sure that you use compatible versions of all dependencies. - The best way to do this is to generate a project with vue-cli to get compatible versions.
Long story short: don't mess with the dependencies