mdbootstrap / mdb-react-ui-kit

React 18 & Bootstrap 5 & Material Design 2.0 UI KIT
https://mdbootstrap.com/docs/b5/react/
Other
1.41k stars 264 forks source link

Can't resolve 'mdbreact' #8

Closed benoitkopp closed 6 years ago

benoitkopp commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

carlgrimm commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

It's fixed in 4.1.0

hiqbalmallick commented 6 years ago

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

mattonit commented 6 years ago

what's your version of React?

hiqbalmallick commented 6 years ago

16.2.0

smolenski-mikolaj commented 6 years ago

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 commented 6 years ago

still not working..

hiqbalmallick commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

I created a new project through: create-react-app myproject Then after installation..i ran the command: npm install --save mdbreact And when i copied the code of navbar for testing purpose..it gave me that error..did i miss something?

Sent from my Windows Phone

-----Original Message----- From: "m_smolenski" notifications@github.com Sent: ‎21/‎02/‎2018 02:14 PM To: "mdbootstrap/React-Bootstrap-with-Material-Design" React-Bootstrap-with-Material-Design@noreply.github.com Cc: "Hamza Iqbal Mallick" hiqbalmallick@gmail.com; "Comment" comment@noreply.github.com Subject: Re: [mdbootstrap/React-Bootstrap-with-Material-Design] Can't resolve'mdbreact' (#8)

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. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

iainalba commented 6 years ago

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

hiqbalmallick commented 6 years ago

Haven't found yet..

Sent from my Windows Phone

-----Original Message----- From: "Iain Richardson" notifications@github.com Sent: ‎27/‎02/‎2018 11:12 PM To: "mdbootstrap/React-Bootstrap-with-Material-Design" React-Bootstrap-with-Material-Design@noreply.github.com Cc: "Hamza Iqbal Mallick" hiqbalmallick@gmail.com; "Comment" comment@noreply.github.com Subject: Re: [mdbootstrap/React-Bootstrap-with-Material-Design] Can't resolve'mdbreact' (#8)

Is there a fix for this? I'm having the same issue — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

vicks1008 commented 6 years ago

Having this same issue.

eduardoroliveira commented 6 years ago

I'm having the same error.

benoitkopp commented 6 years ago

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

benoitkopp commented 6 years ago

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 commented 6 years ago

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

Rotarepmi commented 6 years ago

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

This issue is closed and not tracked.

Vahan777 commented 5 years ago

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

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

This worked for me

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

Taken from StackOverflow

Hanumant1987 commented 1 year ago

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