How to solve the errors with NPM Install? - node.js

I am getting the below errors while doing the npm install but if i do npm install --force? everything works fine in the local environment but not during the repository build as my .yaml file script has the "npm install" Can someone help me on how to fix these issues?
I have tried the below two options but not helped to resolve issue
npm audit fix --force
npm install --legacy-peer-deps
screenshot of the error log
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #angular/localize#10.0.14
npm ERR! Found: #angular/compiler#10.2.3
npm ERR! node_modules/#angular/compiler
npm ERR! #angular/compiler#"^10.2.3" from the root project
npm ERR! peer #angular/compiler#"10.2.3" from #angular/compiler-cli#10.2.3
npm ERR! node_modules/#angular/compiler-cli
npm ERR! dev #angular/compiler-cli#"^10.2.3" from the root project
npm ERR! peer #angular/compiler-cli#"^10.0.0" from #angular-devkit/build-angular#0.1002.3
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^0.1002.3" from the root project
npm ERR! 1 more (#ngtools/webpack)
npm ERR! 1 more (#angular/platform-browser-dynamic)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #angular/compiler#"10.0.14" from #angular/localize#10.0.14
npm ERR! node_modules/#angular/localize
npm ERR! #angular/localize#"^10.0.14" from the root project
npm ERR! peerOptional #angular/localize#"^10.0.0" from #angular-devkit/build-angular#0.1002.3
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^0.1002.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #angular/compiler#10.0.14
npm ERR! node_modules/#angular/compiler
npm ERR! peer #angular/compiler#"10.0.14" from #angular/localize#10.0.14
npm ERR! node_modules/#angular/localize
npm ERR! #angular/localize#"^10.0.14" from the root project
npm ERR! peerOptional #angular/localize#"^10.0.0" from #angular-devkit/build-angular#0.1002.3
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^0.1002.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.

Try to remove the package-lock file & your node_modules folder
and re-run the command npm install --legacy-peer-deps
it should be fine

Related

Stylint error on installing node_modules. Even while running npm start this error keep arrising

Whenever I try to install modules for the project it pops up an error for stylelint.
There is no error in code and even after removing stylelint I am unable to solve this issue
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: stylelint-custom-processor-loader#0.2.1
npm ERR! Found: stylelint#14.11.0
npm ERR! node_modules/stylelint
npm ERR! peer stylelint#"^14.10.0" from stylelint-config-recommended#9.0.0
npm ERR! node_modules/stylelint-config-recommended
npm ERR! dev stylelint-config-recommended#"9.0.0" from the root project
npm ERR! peer stylelint#"^13.0.0 || ^14.0.0" from vite-plugin-stylelint#3.0.7
npm ERR! node_modules/vite-plugin-stylelint
npm ERR! dev vite-plugin-stylelint#"^3.0.7" from the root project
npm ERR! 1 more (the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer stylelint#"^8.0.0" from stylelint-custom-processor-loader#0.2.1
npm ERR! node_modules/stylelint-custom-processor-loader
npm ERR! dev stylelint-custom-processor-loader#"^0.2.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: stylelint#8.4.0
npm ERR! node_modules/stylelint
npm ERR! peer stylelint#"^8.0.0" from stylelint-custom-processor-loader#0.2.1
npm ERR! node_modules/stylelint-custom-processor-loader
npm ERR! dev stylelint-custom-processor-loader#"^0.2.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! See C:\Users\nitin\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\nitin\AppData\Local\npm-cache\_logs\2022-11-13T11_31_25_207Z-debug-0.log

I tried ng add #angular/pwa, but it failed with this error code that I cannot understand. Is there anything I can do to solve this?

npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: my-app#0.0.0
npm ERR! Found: #angular/common#14.2.0
npm ERR! node_modules/#angular/common
npm ERR! #angular/common#"^14.2.3" from the root project
npm ERR! peer #angular/common#"14.2.0" from #angular/forms#14.2.0
npm ERR! node_modules/#angular/forms
npm ERR! #angular/forms#"^14.2.3" from the root project
npm ERR! 4 more (#angular/platform-browser, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! #angular/common#"^14.2.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #angular/core#14.2.3
npm ERR! node_modules/#angular/core
npm ERR! peer #angular/core#"14.2.3" from #angular/common#14.2.3
npm ERR! node_modules/#angular/common
npm ERR! #angular/common#"^14.2.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.
Ok I found the answer through angular communities, you just need to run this command on the terminal
ng update #angular/cli #angular/core

How to resolve npm err: while resolving ... found...?

My project uses Chakra-UI and React. When trying to run npm install, I got this npm error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #choc-ui/chakra-autocomplete#5.1.2
npm ERR! Found: #chakra-ui/react#1.8.8
npm ERR! node_modules/#chakra-ui/react
npm ERR! #chakra-ui/react#"latest" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #chakra-ui/react#"^2.2.8" from #choc-ui/chakra-autocomplete#5.1.2
npm ERR! node_modules/#choc-ui/chakra-autocomplete
npm ERR! #choc-ui/chakra-autocomplete#"^5.1.2" 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" from #chakra-ui/react#2.3.5
npm ERR! node_modules/#chakra-ui/react
npm ERR! peer #chakra-ui/react#"^2.2.8" from #choc-ui/chakra-autocomplete#5.1.2
npm ERR! node_modules/#choc-ui/chakra-autocomplete
npm ERR! #choc-ui/chakra-autocomplete#"^5.1.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.
I don't understand this error, I tried deleting node_modules and package-lock.json, ran npm install again, but same error. Any ideas?
run again npm install --legacy-peer-deps that will solve your issue

yarn react native project with npm

I have an existing project that installs already with yarn and I was trying to install npm but I faced this errors
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: NamalWoocommerce#0.0.1
npm ERR! Found: react-native#0.63.3
npm ERR! node_modules/react-native
npm ERR! react-native#"0.63.3" from the root project
npm ERR! peer react-native#"*" from react-native-render-html#4.2.5
npm ERR! node_modules/react-native-render-html
npm ERR! react-native-render-html#"^4.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native#">=0.60 <0.62" from react-native-webview#8.2.1
npm ERR! node_modules/react-native-webview
npm ERR! react-native-webview#"^8.0.4" from the root project
npm ERR! peer react-native-webview#"*" from react-native-render-html#4.2.5
npm ERR! node_modules/react-native-render-html
npm ERR! react-native-render-html#"^4.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 C:\Users\Ahmed Al-sudairy\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\Ahmed Al-sudairy\AppData\Local\npm-cache\_logs\2022-09-17T07_45_05_943Z-debug-0.log
I deleted yarn.lock but I faced same issue

Installing nest/terminus gives dependency tree error

Whenever I try to install nest/terminus
npm i #nestjs/terminus
I get the following error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: typeorm#0.3.7
npm ERR! Found: ioredis#4.28.5
npm ERR! node_modules/ioredis
npm ERR! peer ioredis#"^4.0.0" from #nestjs-modules/ioredis#1.0.1
npm ERR! node_modules/#nestjs-modules/ioredis
npm ERR! #nestjs-modules/ioredis#"^1.0.1" from the root project
npm ERR! ioredis#"^4.28.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional ioredis#"^5.0.4" from typeorm#0.3.7
npm ERR! node_modules/typeorm
npm ERR! peertypeorm#"^0.3.0" from #nestjs/typeorm#8.1.4
npm ERR! node_modules/#nestjs/typeorm
npm ERR! #nestjs/typeorm#"^8.1.4" from the root project
npm ERR! typeorm#"^0.3.7" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: ioredis#5.2.1
npm ERR! node_modules/ioredis
npm ERR! peerOptional ioredis#"^5.0.4" from typeorm#0.3.7
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.1.4" from the root project
npm ERR! typeorm#"^0.3.7" 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 tried running the following command
npm install --save --legacy-peer-deps
it ran okay, but on repeating the terminus installation I got the same error. Any idea what I might be doing wrong?

Resources