简体   繁体   中英

Unable to install dependencies through npm

I don't know why, but after upgrade the node I am unable to install docz dependencies:( Followed these steps..

  1. npx create-react-app project-name
  2. cd project-name
  3. npm install docz

But I am getting these errors.

npm install docz
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: test@0.1.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 docz@2.3.1
npm ERR! node_modules/docz
npm ERR!   docz@"*" 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\HP\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\HP\AppData\Local\npm-cache\_logs\2022-01-05T13_47_05_954Z-debug-0.log

Please help me, I tried all possible things but can't understand where I am lacking. Actually, I thought it's a problem with my NPM so, tried to install yarn but now this error!!

$ npm install --global yarn

changed 1 package, and audited 2 packages in 3s

found 0 vulnerabilities

HP@LAPTOP-P6Q3FNJ2 MINGW64 ~/Desktop (master)
$ yarn --version
C:\Users\HP\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found

It looks like it is having trouble because the react versions don't match up.

One solution to try is to add --legacy-peer-deps to the end of the command. npm install docz --legacy-peer-deps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM