React application from github not running on VS Code - node.js

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

Related

NPM Next / React package dependency conflict

I know this is related to React / React-DOM package dependency conflict, but the solutions which I can find there don't really help me.
When installing/updating a dependency or when deploying my Next.js app to Vercel, I get some of the following errors:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: use-ackee#3.0.1
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#"^18.0.0" from #testing-library/react#13.4.0
npm ERR! node_modules/#testing-library/react
npm ERR! #testing-library/react#"^13.4.0" from the root project
npm ERR! 5 more (next, react-dom, react-helmet, react-side-effect, styled-jsx)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^17.0.0" from use-ackee#3.0.1
npm ERR! node_modules/use-ackee
npm ERR! use-ackee#"^3.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#17.0.2
npm ERR! node_modules/react
npm ERR! peer react#"^17.0.0" from use-ackee#3.0.1
npm ERR! node_modules/use-ackee
npm ERR! use-ackee#"^3.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!
My package.json looks like this:
"dependencies": {
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^13.5.0",
"next": "^13.1.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"sass": "^1.58.0",
"use-ackee": "^3.0.1",
"web-vitals": "^2.1.4"
},
I'm fully aware that I can just use --force or --legacy-peer-deps and everything works fine, but this seems like it is not really stable.
What is the exact problem I'm dealing with here? What can I do to resolve those conflicts?

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

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

How to install bcrypt for nodejs on Openshift?

Using https://github.com/icflorescu/openshift-cartridge-nodejs to get recent version of node, I ran npm install and got the following error:
npm ERR! Linux 2.6.32-573.12.1.el6.x86_64
npm ERR! argv "/var/lib/openshift/56c8cd172d527182dd0000e7/app-root/data/.nodejs/bin/node" "/var/lib/openshift/56c8cd172d527182dd0000e7/app-root/data/.nodejs/bin/npm" "install"
npm ERR! node v5.6.0
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#0.8.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#0.8.5 install script 'node-gyp rebuild'.
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 bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/lib/openshift/56c8cd172d527182dd0000e7/app-root/runtime/repo/src/bookmap/npm-debug.log
I already tried to explicitly list node-gyp as a dependency in package.json, which results in the same error. Here's my current dependencies from package.json:
"dependencies": {
"angular": "^1.4.8",
"angular-datepicker": "~1.0.5",
"angular-route": "^1.4.8",
"angular-simple-logger": "^0.1.7",
"angular-ui-bootstrap": "^0.14.3",
"node-gyp": "",
"bcrypt": "^0.8.5",
"body-parser": "^1.14.1",
"bootstrap": "^3.3.6",
"bower": "^1.3.9",
"express": "^4.13.3",
"gulp": "^3.8.7",
"gulp-connect": "^2.0.6",
"jwt-simple": "^0.4.0",
"leaflet": "^0.7.7",
"lodash": "^3.10.1",
"path": "^0.12.7",
"pg": "^4.4.3",
"ui-leaflet": "^1.0.0",
"winston": "^2.1.1"
}
node-gyp installs just fine with npm install node-gyp.
I recommend using the javascript version of bcrypt so you don't have to deal with building it on openshift. We use bcrypt-nodejs on openshift and it works well https://www.npmjs.com/package/bcrypt-nodejs
All you need is just to put it under dependencies in package.json. This is what we have but you can check and get the latest version:
"bcrypt-nodejs": ">=0.0.3",
bcrypt-nodejs is not working in openshift.
use this https://www.npmjs.com/package/bcryptjs

Resources