Can't resolve some dependency errors in nodejs - node.js

I was trying to install dependencies of a website and I get this error that I couldn't solve following some of the already published solutions.
Here is the error. Thanks in advance for your help.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: samar#0.1.0
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"^17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^0.14.0 || ^15.0.0" from react-rangeslider#2.2.0
npm ERR! node_modules/react-rangeslider
npm ERR! react-rangeslider#"^2.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/intelligentica/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/intelligentica/.npm/_logs/2022-03-23T15_30_51_251Z-debug-0.log
The package.json file is here.
{
"name": "samar",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 5000",
"build": "next build",
"start": "next start",
"sass": "node-sass --watch scss/main.scss css/style.css --source-map css/style.css.map"
},
"dependencies": {
"moment": "^2.29.1",
"next": "^10.0.6",
"node-sass": "^5.0.0",
"react": "^17.0.1",
"react-bootstrap": "^1.5.0",
"react-countup": "^4.3.3",
"react-dom": "^17.0.1",
"react-google-recaptcha": "^2.1.0",
"react-modal-video": "^1.2.6",
"react-rangeslider": "^2.2.0",
"react-router-dom": "^5.2.0",
"react-scroll-to-top": "^1.0.5",
"react-slick": "^0.28.0",
"react-visibility-sensor": "^5.1.1",
"simple-react-lightbox": "^3.6.6",
"slick-carousel": "^1.8.1",
"use-scroll-position": "0.0.4",
"wowjs": "^1.1.3"
}
}

I would suggest you to delete the node-modules folder and make sure to install dependencies latest version by adding
npm i packagename#latest

Delete the node_modules folder and install the dependencies using --force, or --legacy-peer-deps
npm install --force

Related

how to fix npm install for react native

i am using react native to build a app every time I try to install a npm package i have to use --force, or --legacy-peer-deps to make it install else i get error so i thought it is because of version of react in my pakgage.json so i dissided to downgrade my react to 17.0.1 from 18.1.0 and i deleted my pakage.lock.json and node modules and i tried npm i then I am getting this error i want to get a clean installation for react native
npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: sukprsavam#0.0.1
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! react#"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native#"^0.0.0-0 || 0.60 - 0.71 || 1000.0.0" from #react-native-async-storage/async-storage#1.17.11
npm ERR! node_modules/#react-native-async-storage/async-storage
npm ERR! #react-native-async-storage/async-storage#"^1.17.11" 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! peer react#"18.1.0" from react-native#0.70.6
npm ERR! node_modules/react-native
npm ERR! react-native#"0.70.6" from the root project
npm ERR! peer react-native#"^0.0.0-0 || 0.60 - 0.71 || 1000.0.0" from #react-native-async-storage/async-storage#1.17.11
npm ERR! node_modules/#react-native-async-storage/async-storage
npm ERR! #react-native-async-storage/async-storage#"^1.17.11" 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\vivek\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\vivek\AppData\Local\npm-cache\_logs\2023-01-04T06_02_30_598Z-debug-0.log
"name": "newapp",
"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-navigation/native": "^6.1.1",
"#react-navigation/native-stack": "^6.9.7",
"axios": "^1.2.2",
"expo": "~47.0.9",
"expo-status-bar": "~1.4.2",
"moment": "^2.29.4",
"react": "18.1.0",
"react-client-session": "^0.0.8",
"react-native": "0.70.5",
"react-native-network-logger": "^1.13.0",
"react-native-paper": "^5.1.2",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-navigation": "^4.4.4"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}

how to resolve dependency tree typeorm and nestjs during node modules installation

During installation of a Nest Application node modules, I have the following error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ticket-be#0.1.3
npm ERR! Found: typeorm#0.2.45
npm ERR! node_modules/typeorm
npm ERR! typeorm#"^0.2.45" from the root project
npm ERR! peer typeorm#"^0.2.25" from #nestjs-query/query-typeorm#0.30.0
npm ERR! node_modules/#nestjs-query/query-typeorm
npm ERR! #nestjs-query/query-typeorm#"^0.30.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typeorm#"^0.3.0" from #nestjs/typeorm#8.1.4
npm ERR! node_modules/#nestjs/typeorm
npm ERR! #nestjs/typeorm#"^8.0.3" from the root project
npm ERR! peer #nestjs/typeorm#"^8.0.0" from #nestjs-query/query-typeorm#0.30.0
npm ERR! node_modules/#nestjs-query/query-typeorm
npm ERR! #nestjs-query/query-typeorm#"^0.30.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.
Can you give me suggestions to resolve dependency? Or is better to use --force or --legacy-peer-deps?
Thank you in advance.
Here dependencies section of my package.json
"dependencies": {
"#nestjs-modules/mailer": "^1.6.1",
"#nestjs-query/query-typeorm": "^0.30.0",
"#nestjs/common": "^8.4.4",
"#nestjs/config": "^2.0.0",
"#nestjs/core": "^8.0.0",
"#nestjs/jwt": "^8.0.0",
"#nestjs/mapped-types": "*",
"#nestjs/passport": "^8.2.1",
"#nestjs/platform-express": "^8.0.0",
"#nestjs/swagger": "^5.2.1",
"#nestjs/typeorm": "^8.0.3",
"#types/bcrypt": "^5.0.0",
"#types/cookie-parser": "^1.4.2",
"bcrypt": "^5.0.1",
"class-transformer": "^0.4.0",
"class-validator": "^0.13.2",
"cookie-parser": "^1.4.6",
"fastify-swagger": "^5.1.0",
"handlebars": "^4.7.7",
"joi": "^17.6.0",
"passport": "^0.5.2",
"passport-jwt": "^4.0.0",
"passport-local": "^1.0.0",
"pdfmake": "^0.2.5",
"pg": "^8.7.3",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"swagger-themes": "^1.2.22",
"swagger-ui-express": "^4.3.0",
"typeorm": "^0.2.45",
"uuid": "^8.3.2",
"webpack": "^5.72.1"
}
I tried to remove "typeorm": "^0.2.45" from package.json, but I have same type error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ticket-be#0.1.3
npm ERR! Found: typeorm#0.3.10
npm ERR! node_modules/typeorm
npm ERR! peer typeorm#"^0.3.0" from #nestjs/typeorm#8.1.4
npm ERR! node_modules/#nestjs/typeorm
npm ERR! #nestjs/typeorm#"^8.0.3" from the root project
npm ERR! peer #nestjs/typeorm#"^8.0.0" from #nestjs-query/query-typeorm#0.30.0
npm ERR! node_modules/#nestjs-query/query-typeorm
npm ERR! #nestjs-query/query-typeorm#"^0.30.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typeorm#"^0.2.25" from #nestjs-query/query-typeorm#0.30.0
npm ERR! node_modules/#nestjs-query/query-typeorm
npm ERR! #nestjs-query/query-typeorm#"^0.30.0" from the root project
#nestjs/typeorm#8.1.4 requires that you use typeorm#^0.3.0 but #nestjs-query/query-typeorm#"^0.30.0" requires that you use typeorm#^0.2.25. You need to downgrade #nestjs/typeorm to something that is compatible with #nestjs-query/query-typeorm or upgrade #nestjs-query/query-typeorm to something that has a compatible typeorm version with #nestjs/typeorm#^8.1.4
I fixed version:
"#nestjs/typeorm": "8.0.3"
and now it works, thanks #jay-mcdoniel

Unable resolve dependency after vue upgrade

I try to upgrade my vue version from 3.0.2 to latest version with syntax:
vue upgrade
after that, my vue #vue/cli-service is upgraded to 5.0.8
But then when the process is want to upgade #vue/cli-plugin-babel and #vue/cli-plugin-eslint it say an error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: app-backend-vue#0.1.0
npm ERR! Found: eslint#6.8.0
npm ERR! node_modules/eslint
npm ERR! dev eslint#"^6.8.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint#">=7.5.0" from #vue/cli-plugin-eslint#5.0.8
npm ERR! node_modules/#vue/cli-plugin-eslint
npm ERR! dev #vue/cli-plugin-eslint#"^5.0.8" 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.
My devDependencies in package.json:
"devDependencies": {
"#vue/cli-plugin-babel": "^4.5.19",
"#vue/cli-plugin-eslint": "^4.5.19",
"#vue/cli-service": "~5.0.8",
"#vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^7.0.0-0"
},
How to fix this? And how to clearly upgrade my vue version?
Before the upgrade, my devDependencies were
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^7.0.0-0"

React application from github not running on VS Code

sorry for newbie question. I have downloaded a react application from github. When I try to run locally on VS Code it gives me some dependencies errors.
Below is the dependencies on the json file:
"dependencies": {
"#chakra-ui/react": "^1.8.5",
"#emotion/react": "^11",
"#emotion/styled": "^11",
"#hookform/resolvers": "^2.8.8",
"algoliasearch": "^4.12.1",
"axios": "^0.26.0",
"framer-motion": "^6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-hook-form": "^7.27.1",
"react-icons": "^4.3.1",
"react-images-uploading": "^3.1.3",
"react-instantsearch-dom": "^6.22.0",
"react-query": "^3.34.16",
"react-router-dom": "^6.2.1",
"react-table": "^7.7.0",
"recharts": "^2.1.9",
"sass": "^1.49.9",
"yup": "^0.32.11",
"zustand": "^3.7.0"
}
Error:
npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: admin-family#0.0.0
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0" from react-images-uploading#3.1.3
npm ERR! node_modules/react-images-uploading
npm ERR! react-images-uploading#"^3.1.3" 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\12392\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\12392\AppData\Local\npm-cache\_logs\2022-03-09T00_59_26_007Z-debug-0.log
Running node v16.14.0
Any help on this appreciated.
run npm install --force or npm install --legacy-peer-deps
this will fix the error, because it ignores the peer dependencies and focuses on the main dependencies.
this has worked for me whenever i've gotten this error

NPM Install Errors

When running npm install I am getting an error that isn't reproducible on other computers. After installing everything and running webpack build it spews out an error. When looking at the directory webpack should have installed in it doesn't even exist. Is this a known npm install bug on mac?
Error when running
npm install:
> www# postinstall /Users/mackenzie/Desktop/omitted/www
> npm run webpack-build
> www# webpack-build /Users/mackenzie/Desktop/omitted/www
> NODE_ENV=production ./node_modules/.bin/webpack -p --no-color
sh: ./node_modules/.bin/webpack: No such file or directory
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.4.0/bin/node" "/Users/mackenzie/Desktop/omitted/www/node_modules/.bin/npm" "run" "webpack-build"
npm ERR! node v7.4.0
npm ERR! npm v3.10.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! www# webpack-build: `NODE_ENV=production ./node_modules/.bin/webpack -p --no-color`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the www# webpack-build script 'NODE_ENV=production ./node_modules/.bin/webpack -p --no-color'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the www package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! NODE_ENV=production ./node_modules/.bin/webpack -p --no-color
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs www
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls www
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/mackenzie/Desktop/omitted/www/npm-debug.log
npm WARN www# No license field.
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.4.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! www# postinstall: `npm run webpack-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the www# postinstall script 'npm run webpack-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the www package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run webpack-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs www
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls www
package.json
"scripts": {
"lint": "semistandard web/js/orders/* web/js/categories/* web/js/orders/* web/js/site/* web/js/user/*",
"webpack-dev": "NODE_ENV=development ./node_modules/.bin/webpack --watch --progress",
"webpack-build": "NODE_ENV=production ./node_modules/.bin/webpack -p --no-color",
"postinstall": "npm run webpack-build"
},
"devDependencies": {
"autoprefixer": "^6.5.2",
"babel-core": "^6.18.2",
"babel-loader": "^6.2.7",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"browser-sync": "^2.17.5",
"browser-sync-webpack-plugin": "^1.1.3",
"css-loader": "^0.25.0",
"eslint": "^3.10.1",
"eslint-config-semistandard": "^7.0.0",
"eslint-config-standard": "^6.2.1",
"eslint-config-standard-react": "^4.2.0",
"eslint-loader": "^1.6.1",
"eslint-plugin-promise": "^3.3.2",
"eslint-plugin-standard": "^2.0.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"path": "^0.12.7",
"postcss-loader": "^1.1.0",
"semistandard": "^9.0.0",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "^1.13.3",
"webpack-dev-middleware": "^1.8.4",
"webpack-hot-middleware": "^2.13.1"
},
"dependencies": {
"i": "^0.3.5",
"lodash": "^4.16.6",
"npm": "^3.10.9",
"react": "^15.3.2",
"react-addons-css-transition-group": "^15.3.2",
"react-dom": "^15.3.2"
}
NPM picked is different
npm ERR! npm v3.10.9
npm ERR! npm v4.0.5
Try:
sudo npm install --unsafe-perm=true --allow-root
suggested by external link to solution

Resources