@grafana/toolkit doesn’t install (dependencies)

What happened:
I couldn’t install @grafana/toolkit

What you expected to happen:
I would like to install @granana/toolkit without problems

How to reproduce it (as minimally and precisely as possible):
npm install @grafana/toolkit

Anything else we need to know?:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@16.14.0
npm ERR! node_modules/react
npm ERR! peer react@”>=16.3.0″ from @emotion/core@10.1.1
npm ERR! node_modules/@emotion/core
npm ERR! @emotion/core@”^10.0.27″ from @grafana/ui@7.4.2
npm ERR! node_modules/@grafana/ui
npm ERR! @grafana/ui@”7.4.2″ from @grafana/toolkit@7.4.2
npm ERR! node_modules/@grafana/toolkit
npm ERR! @grafana/toolkit@”” from the root project
npm ERR! @emotion/core@”^10.0.9″ from @torkelo/react-select@3.0.8
npm ERR! node_modules/@torkelo/react-select
npm ERR! @torkelo/react-select@”3.0.8″ from @grafana/ui@7.4.2
npm ERR! node_modules/@grafana/ui
npm ERR! @grafana/ui@”7.4.2″ from @grafana/toolkit@7.4.2
npm ERR! node_modules/@grafana/toolkit
npm ERR! peer react@”>=16.6.0″ from @grafana/slate-react@0.22.9-grafana
npm ERR! node_modules/@grafana/slate-react
npm ERR! @grafana/slate-react@”0.22.9-grafana” from @grafana/ui@7.4.2
npm ERR! node_modules/@grafana/ui
npm ERR! @grafana/ui@”7.4.2″ from @grafana/toolkit@7.4.2
npm ERR! node_modules/@grafana/toolkit
npm ERR! @grafana/toolkit@”
” from the root project
npm ERR! 29 more (slate-react-placeholder, slate-react, …)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@”17.0.1″ from react-dom@17.0.1
npm ERR! node_modules/react-dom
npm ERR! react-dom@”17.0.1″ from @grafana/ui@7.4.2
npm ERR! node_modules/@grafana/ui
npm ERR! @grafana/ui@”7.4.2″ from @grafana/toolkit@7.4.2
npm ERR! node_modules/@grafana/toolkit
npm ERR! @grafana/toolkit@”*” from the root project
npm ERR! peer react-dom@”>=16.6.0″ from @grafana/slate-react@0.22.9-grafana
npm ERR! node_modules/@grafana/slate-react
npm ERR! @grafana/slate-react@”0.22.9-grafana” from @grafana/ui@7.4.2
npm ERR! node_modules/@grafana/ui
npm ERR! @grafana/ui@”7.4.2″ from @grafana/toolkit@7.4.2
npm ERR! node_modules/@grafana/toolkit

Environment:

  • npm version 7.5.3
  • node version 15.9.0

1 possible answer(s) on “@grafana/toolkit doesn’t install (dependencies)

  1. I can reproduce this locally using the versions of node and npm specified in the report. This appears to be due to a breaking change introduced in npm v7 related to the algorithm used for resolving peer dependencies. If I downgrade to npm v6 the issue goes away. @j-dc could you try running the following command and let us know if it works please?

    npm install @grafana/toolkit --legacy-peer-deps

    To solve this I think we will need to fix the mismatch of react versions (v16 and v17) we currently have in the dependency tree.