material-table: Unable to install material-table with @material-ui/core with npm 7

Guidelines

  • Please include a demo of the issue/behavior/question you have

$ npm i                                         
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: gatsby-stratos@1.0.0
npm ERR! Found: @material-ui/core@4.11.2
npm ERR! node_modules/@material-ui/core
npm ERR!   @material-ui/core@"^4.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @material-ui/core@"4.0.1" from material-table@1.69.2
npm ERR! node_modules/material-table
npm ERR!   material-table@"^1.69.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.
npm ERR! 
npm ERR! See /home/amchelle/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/amchelle/.npm/_logs/2021-01-02T23_46_17_706Z-debug.log

with npm version 7.3.0

Describe the bug A clear and concise description of what the bug is.

I’m unable to install the latest material-table package next to @material-ui/core with npm 7 due to the new peerDependency resolutions.

To Reproduce Steps to reproduce the behavior:

npm install with the following package.json:

{
  "dependencies": {
    "@material-ui/core": "^4.0.1",
    "material-table": "^1.69.2",
  }
}

Expected behavior I expect npm install to succeed

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser n/a

Additional context

The issue appears to be caused by specific version pins (without semver ranges) in the peerDependencies section of this package’s package.json. We should be using the widest ranges possible now that npm 7 is strict in its resolution of peerDependencies

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 24
  • Comments: 16

Most upvoted comments

Just add --force: npm i material-table --save --force , this problem will be solved.

I’m facing the same issue. Npm version 7.0.3 and React Version 17.0.1, on Windows 10. Any Fixes yet?

Try with Yarn. Its working

Have you tried the —legacy-peer-deps flag?

I’m facing the same issue. Npm version 7.0.3 and React Version 17.0.1, on Windows 10. Any Fixes yet?

I’m facing the same issue. Npm version 7.5.4 on ubuntu 20.04 LTS

Solved! I was using the 12 version of npm. Then I just update it to 14, I delete the node_modules folder and and then, the library started working normaly.

That’s one workaround, but it removes the desired behavior of npm 7 installing peer dependencies for every other package, so in most cases will not be sufficient

Thanks peterohu, my problem has been solved by applying --force.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.