Material-ui: Module not found: Error: Can't resolve '@material-ui/core/Link'

Created on 7 Feb 2019  路  3Comments  路  Source: mui-org/material-ui


Running with @material-ui/core": "^3.9.2 throws error above.
Link is being used as per your docs.

import { Link as RouterLink } from 'react-router-dom'
import Link from '@material-ui/core/Link';

  • [x ] This is not a v0.x issue.
  • [ x] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 馃

Should load the Link component.

Current Behavior 馃槸

Throws the error above when running Webpack 4.

Steps to Reproduce 馃暪

Run Webpack 4 on code above.

Context 馃敠

Your Environment 馃寧

| Tech | Version |
|--------------|---------|
| Material-UI | v3.9.2 |
| React | v16.7.0 |
| Browser | mac terminal |
| TypeScript | Visual Studio Code |
| etc. | |

Link incomplete

Most helpful comment

Well, go figure.
I had the error, then upgraded to 3.9.2 and kept on having it. Now I removed material-ui's Link and replaced with react-router-dom Link. That worked fine.
Following your message I reversed to the docs formula and it now works fine. As you said, there was some issue with the build process that disappeared when I went back and forth.
Thanks

All 3 comments

It seems to be working fine with the exact same import syntax in codesandbox. I suspect that your build pipeline causes this issue. Could you provide a full repro? Maybe verify that other components are working?

Well, go figure.
I had the error, then upgraded to 3.9.2 and kept on having it. Now I removed material-ui's Link and replaced with react-router-dom Link. That worked fine.
Following your message I reversed to the docs formula and it now works fine. As you said, there was some issue with the build process that disappeared when I went back and forth.
Thanks

Upgrading Material UIdependencies solved this issue

    "@material-ui/core": "^3.9.2",
    "@material-ui/icons": "^3.0.2",
    "@material-ui/lab": "^3.0.0-alpha.30",
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mnajdova picture mnajdova  路  105Comments

chadobado picture chadobado  路  119Comments

nathanmarks picture nathanmarks  路  100Comments

aranw picture aranw  路  95Comments

kybarg picture kybarg  路  164Comments