Getting error trying to install latest versions of React and Polaris

New Member
2 1 0

I am just getting into Shopify app development with React and Polaris and even before I write a single line of code I am confronted with this error when trying to simply install the latest version of React + Polaris.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: sample_app@1.0.0
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@"^16.9.0" from @Shopify/polaris@6.0.1
npm ERR! node_modules/@shopify/polaris
npm ERR!   @Shopify/polaris@"*" from the root project


Is anyone else getting this error? Is the only solution to install an older version of React?

New Member
2 1 0

This is an accepted solution.


Normally I am used to installing the primary libraries first like React but in this instance installing @Shopify/polaris first and letting npm figure out the necessary versions for React and React-dom worked like a charm.

FIX: Install @Shopify/polaris first then react, react-dom, next libraries.

"@shopify/koa-shopify-auth": "^3.2.0",
    "@shopify/polaris": "^6.0.1",
    "dotenv": "^8.2.0",
    "isomorphic-fetch": "^3.0.0",
    "koa": "^2.13.1",
    "koa-session": "^6.1.0",
    "next": "^10.0.7",
    "react": "^16.14.0",
    "react-dom": "^16.14.0"