Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve 'mdbreact' #8

Closed
benoitkopp opened this issue Nov 13, 2017 · 26 comments
Closed

Can't resolve 'mdbreact' #8

benoitkopp opened this issue Nov 13, 2017 · 26 comments

Comments

@benoitkopp
Copy link

benoitkopp commented Nov 13, 2017

Hello,

When i try to import Button and Collapse, i get:

Import:
import { Button, Collapse } from 'mdbreact';

Error:
Module not found: Can't resolve 'mdbreact' in 'C:\wamp64\www\bob-web\notice-cmi\src\components\Collapsable'

I installed it with npm. Did i miss something ?

@carlgrimm
Copy link

I noticed in their project they used an alias that points to where the /src directory lives in the resolve section of the webpack config.

resolve: { alias: { mdbreact: path.resolve('./src/index') } },

@juergengunz
Copy link

@carlgrimm so what is the solution ? I don't get it. same issue for me

@carlgrimm
Copy link

carlgrimm commented Dec 9, 2017

One way is to get an alias into the resolve config section of your webpack configuration file if you are using webpack to build.

This repo builds the docs site using webpack and you can see in their configuration file that they create a resolve alias that maps mdbreact to the components they export in /src/index.js which fixes this en-mass for all of the components.

it also appears that the git repo might be out of sync with NPM package. The git repo has an index.js file that helps load everything that seems to be missing when you add from NPM.

@hunterdt
Copy link

I'm having the same problem. I tried installing from NPM and from Github download, but couldn't get it to work.

Anyone find out exactly what needs to be done to solve this?

@mattonit
Copy link

It's fixed in 4.1.0

@hiqbalmallick
Copy link

@mattonit it's not fixed..still i'm getting this issue..please help me to solve it..

@mattonit
Copy link

what's your version of React?

@hiqbalmallick
Copy link

16.2.0

@smolenski-mikolaj
Copy link
Contributor

Hello,
This error which could be connected with the latest upgrade of React. We've fixed it by updating our product to the latest React version. Please delete 'mdbreact' from package.json, reinstall and then add to dependencies this line:

"mdbreact":"git+https://github.com/mdbootstrap/React-Bootstrap-with-Material-Design.git#react-upgrade"

Let us know if it works properly.

Regards

@hiqbalmallick
Copy link

still not working..

@hiqbalmallick
Copy link

its giving multiple errors now..jquery not defined..when i'm trying to test by copying the navbar code..'navbar' has no owner...such things..

@smolenski-mikolaj
Copy link
Contributor

Please build a new React App and check our mdbreact with it. It's not possible to see jquery errors because it's not working with jquery, but with plain js. If it's still not working please write what are Your steps to create this App.

@hiqbalmallick
Copy link

hiqbalmallick commented Feb 21, 2018 via email

@iainalba
Copy link

Is there a fix for this? I'm having the same issue

@hiqbalmallick
Copy link

hiqbalmallick commented Feb 28, 2018 via email

@vicks1008
Copy link

Having this same issue.

@eduardoroliveira
Copy link

I'm having the same error.

@benoitkopp
Copy link
Author

Since new updates, it's working, which version do you use ?

@benoitkopp
Copy link
Author

Still importing like:

import { Button, Modal, ModalBody, ModalHeader } from 'mdbreact';
I'm running it on an older version (4.3.0) with React 16.3.2 and it works great :)

@nyashafrank
Copy link

Is there a solution to this yet? Still having the same issue with mdbreact 4.8.3

@Rotarepmi
Copy link
Contributor

If you have problem with installation please check out our support forum, or open new issue.

This issue is closed and not tracked.

@Vahan777
Copy link

У меня та же ошибка.

ERROR in ./src/components/Boxes.js
Module not found: Error: Can't resolve 'mdbreact' in 'C:\Users\User\Desktop\react2\src\components'
@ ./src/components/Boxes.js 19:16-35
@ ./src/components/App.js
@ ./src/index.js
@ multi (webpack)-dev-server/client?http://localhost:9000 webpack/hot/dev-server ./src/index.js

@ferryal
Copy link

ferryal commented Jan 3, 2019

same issue, module not found.
Could not find a declaration file for module 'mdbreact'. '/Users/feri/Documents/amartha/react-p2p/app/node_modules/mdbreact/dist/mdbreact.js' implicitly has an 'any' type.

@JoelBrice
Copy link

JoelBrice commented Jan 13, 2019

Hello @ferryal !
Here is what solved the problem for me:
Run the following commands:

  1. npm install --save mdbreact
  2. npm install
    If you have any error with Routing, use the following in the index.js;
    import { BrowserRouter } from 'react-router-dom';

// Modify the ReactDOM.render() to the below

ReactDOM.render(

, document.getElementById('root'));

@PokatilovArt
Copy link

This worked for me

const mdbreact = require('mdbreact'); const { Button, Collapse } = mdbreact;

Taken from StackOverflow

@Hanumant1987
Copy link

Step 1
npm install --save mdbreact

Step 2

Import style files into the src/index.js before the App.js file import:

index.js
import '@fortawesome/fontawesome-free/css/all.min.css';
import 'bootstrap-css-only/css/bootstrap.min.css';
import 'mdbreact/dist/css/mdb.css';

Step 3

Run your app

Terminal
npm start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests