Search code examples
reactjsimportmaterialize

Module not found: Can't resolve 'react-materialize'


I'm trying to use a package called materialize, i installed it with npm install react-materialize --save, then I ran npm install but I get an error saying it can't find the package.

Failed to compile.

./src/index.js
Module not found: Can't resolve 'react-materialize' in 'C:\Users\User\Desktop\reactcamera\src'

Package.Json

"react-materialize": "^2.0.6"

index.js

import {Button} from "react-materialize";

Solution

  • Had to include this in index.html:

    <head>
      <link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css" rel="stylesheet">
    
    </head>
    
    
    <body>
     <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/js/materialize.min.js"></script>
    
    </body>
    

    I don't understand why i have to include these in index.html but it works now.