I'm using react native 0.63.4 and react 16.13.1. I try to install 'styled-components' with
npm install --save styled-components
and failed with these messages:
`code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"16.13.1" from the root project
npm ERR! peer react@">= 16.8.0" from [email protected]
npm ERR! node_modules/styled-components
npm ERR! styled-components@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.1" from [email protected]
npm ERR! node_modules/react-dom
npm ERR! peer react-dom@">= 16.8.0" from [email protected]
npm ERR! node_modules/styled-components
npm ERR! styled-components@"*" 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! `
I was not sure what the problems are. Please if anyone can help me. Thanks.
UPDATE https://github.com/npm/cli/issues/2120
Also there is a issue with npm resolving peer-dependencies, npm-CLI currently breaks standard NPM7 installs of several major dependencies, such as for example styled-component, your npm version is 7.+ also
Try downgrading to npm 6 or install another version of styled-components
or you can use yarn to install styled-components
yarn add styled-components
I ended up using yarn to instal styled-components, and it works.
yarn add styled-components
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With