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

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

Related

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"
}

Build Failed Command "npm install" exited with 1 [duplicate]

This question already has answers here:
Fix the upstream dependency conflict installing NPM packages
(15 answers)
Closed 5 months ago.
so since the project started the deploy never had a problem, and out of nowhere today this message started to appear on vercel...
the application was coded using next js
I searched and searched and couldn't find a solution that worked for me...
Cloning github.com/ThiagoC0STA/kfk (Branch: main, Commit: f69b855)
Cloning completed: 1.077s
Looking up build cache...
Build Cache not found
Running "vercel build"
Vercel CLI 28.2.2
Installing dependencies...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-elastic-carousel#0.11.5
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"18.2.0" from the root project
npm ERR! peer react#"^17.0.2 || ^18.0.0-0" from next#12.2.5
npm ERR! node_modules/next
npm ERR! next#"12.2.5" from the root project
npm ERR! 5 more (react-dom, react-slick, styled-components, styled-jsx, use-sync-external-store)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"15 - 17" from react-elastic-carousel#0.11.5
npm ERR! node_modules/react-elastic-carousel
npm ERR! react-elastic-carousel#"^0.11.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#17.0.2
npm ERR! node_modules/react
npm ERR! peer react#"15 - 17" from react-elastic-carousel#0.11.5
npm ERR! node_modules/react-elastic-carousel
npm ERR! react-elastic-carousel#"^0.11.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.
npm ERR!
npm ERR! See /vercel/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /vercel/.npm/_logs/2022-09-12T18_11_25_601Z-debug-0.log
Error: Command "npm install" exited with 1
package.json
{
"name": "kfk",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.2.5",
"next-images": "^1.8.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-elastic-carousel": "^0.11.5",
"react-slick": "^0.29.0",
"slick-carousel": "^1.8.1",
"styled-components": "^5.3.5"
},
"devDependencies": {
"babel-plugin-styled-components": "^2.0.7",
"eslint": "8.22.0",
"eslint-config-next": "12.2.5"
}
}
I don't understand why I have this error out of the blue, since I've been deploying for weeks and this started out of nowhere.
Try running
npm install --legacy-peer-deps
If it's necessary, you can try to use --force
npm install --force
Here was the docs
Npm install --force

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 ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree in react

I am doing a mern project in that I used the following command
npm i react-router-dom axios react-paypal-express-checkout
In that I faced the following error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: client#0.1.0
npm ERR! Found: react#18.0.0
npm ERR! node_modules/react
npm ERR! react#"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"~0.14.8 || ^15.5.0" from react-paypal-express-checkout#1.0.5
npm ERR! node_modules/react-paypal-express-checkout
npm ERR! react-paypal-express-checkout#"*" 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\nahee\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\nahee\AppData\Local\npm-cache\_logs\2022-04-11T15_43_33_096Z-debug.log
And my package.json file is:
{
"name": "animal_feedmart",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.0",
"cloudinary": "^1.23.0",
"concurrently": "^5.3.0",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-fileupload": "^1.2.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.10.1"
},
"devDependencies": {
"nodemon": "^2.0.4"
}
}
Can anyone help me to clear this error.
Thanks in advance
I had a similar issue but the errors were after npx create-react-app. I found a solution, you need to type npm config set legacy-peer-deps true.
npm i react-router-dom --force
OR
npm i anylibirary --legacy-peer-deps
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: client#0.1.0
npm ERR! Found: react#18.0.0
npm ERR! node_modules/react
npm ERR! react#"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"~0.14.8 || ^15.5.0" from react-paypal-express-checkout#1.0.5
npm ERR! node_modules/react-paypal-express-checkout
npm ERR! react-paypal-express-checkout#"*" 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\nahee\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\nahee\AppData\Local\npm-cache_logs\2022-04-11T15_43_33_096Z-debug.log
if you ever faced this problem then
then you have to do
npm install example --force
at the place of example whatever you want to install