Error comes while using same MDB React Pro token In another


Topic: Error comes while using same MDB React Pro token In another device

rashesh patel asked 5 years ago

Hi, Currently, I am using MDB React Pro in One project in One device, I am trying to use the same project with my same pro token with another device but there are error comes like

"Attempted import error: 'MDBAvatar' is not exported from 'mdbreact'"

It's already imported in that particular file. If I delete that file and run the project than same error comes with other components instead of 'MDBAvatar'

what should I do???


Jakub Chmura staff premium answered 5 years ago

@rashesh patel,

Please delete your node_modules folder in your new project and type in console yarn or npm i. Its probable problem with these packages so you need to reinstall it.

If my solution will not help you please give me more details about your installation method in a new project then I will try to help.

Best, Kuba


rashesh patel commented 5 years ago

Hi Kuba, I have tried that but still facing problem.

I have tried.... 1)I have installed mdbreact in my existing project using 'npm install --save mdbreact'

2)In package.json dependencies shows "mdbreact": "^4.23.1",

3)I have replace that mdbreact dependency with my token "mdbreact": "git+https://oauth2:MY TOKEN@git.mdbootstrap.com/mdb/react/re-pro.git",

4) Than I ran the code but error comes

./src/components/pages/About.js Attempted import error: 'MDBAvatar' is not exported from 'mdbreact'.

5)Than as per your suggestion I have deleted node_modules folder and reinstalled it using 'npm i'.

And again Error came

npm ERR! code ENOENT
npm ERR! syscall spawn git npm ERR! path git
npm ERR! errno -4058 npm ERR! enoent Error while executing: npm ERR! enoent undefined ls-remote -h -t https://oauth2:MYTOKEN@git.mdbootstrap.com/mdb/react/re-pro.git


Jakub Chmura staff premium commented 5 years ago

Did you delete package-lock.json and yarn.lock ?

I need to ask you to do it in another way. Please do not install mdbreact in that way what you describe in 1).

Please open your package.json in your project (it's important to do it on your project without installed mdb package) and paste "mdbreact": "git+https://oauth2:MY TOKEN@git.mdbootstrap.com/mdb/react/re-pro.git", in your dependency (not devDependency or peerDependency). and be sure to replace MYTOKEN your token from gitlab correctly.

Do not install yet.

Remove node_modules package-lock.json or/and yarn.lock and then install packages by usingnpm i command.

Let me know if it works for your case

Best, Kuba


rashesh patel commented 5 years ago

Hi Kuba,

I have tried the same way as you said...but still, get the same error.

npm ERR! code ENOENT npm ERR! syscall spawn git npm ERR! path git npm ERR! errno -4058 npm ERR! enoent Error while executing: npm ERR! enoent undefined ls-remote -h -t https://oauth2:MYTOKEN@git.mdbootstrap.com/mdb/react/re-pro.git


Jakub Chmura staff premium commented 5 years ago

  1. try to clean your node cache. Type in your console npm cache clean and check then you can install your project. If it won't work. please use the same command in a console in your project directory but with -- force flag: npm cache clean --force.
  2. If my solution did not work in your case please reinstall yournode.js version and then try to install your project with MDB react

Best, Kuba.


rashesh patel commented 5 years ago

Hi Kuba,

Thank you, That problem is solved.

Now while running the project, error comes

"Error: Invariant failed: You should not use Navlink outside a Router"

This Error also came before 2 months in my 1st device in which my project is running on MDB 4.18.1, Please refer below link for that https://mdbootstrap.com/support/react/error-coming-after-updating-mdb-react-from-4-18-1-to-4-21-0/

In that Konrad said I have to wait till MDB react version 5.0.0 came, Now its already 2 months,I can not wait more for this please give me the other solution for it.

Thank you.


Jakub Chmura staff premium answered 5 years ago

Hi @rashesh patel

You can do that. Please delete your node_modules, and package-lock.json. Now change your token, to do that please open your package.json in your project and change line "mdbreact": "git+https://oauth2:MYTOKEN@git.mdbootstrap.com/mdb/react/re-pro.git", in your dependency to "mdbreact": "git+https://oauth2:MYTOKEN@git.mdbootstrap.com/mdb/react/re-pro.git#4.18.1",

Then just run npm install, after installation version 4.18.1 should install properly.

Best regards,

Kuba.


rashesh patel commented 5 years ago

Hi Kuba, Now it's properly working on 4.18.1 version, Thank you for support.

One last query regarding version- How to check on which MDB version I am working while using token("mdbreact": "git+https://oauth2:MYTOKEN@git.mdbootstrap.com/mdb/react/re-pro.git")?


Jakub Chmura staff premium commented 5 years ago

Two simplest way to check the MDB package version is :

  1. run your console in your project directory and run npm list --depth=0.
  2. Go to your node_modules and search mdbreact folder and check the version in README.txt file

Best, Kuba


rashesh patel commented 5 years ago

Got it...Thank you, Kuba.


Jakub Chmura staff premium commented 5 years ago

You're welcome!   If there is anything else I could do for you do not hesitate to ask me. I'll be happy to help you.   Best Regards,   Kuba


Jakub Chmura staff premium answered 5 years ago

Hi @rashesh patel,

Nice to hear that your first problem was solved.

A React v5.0.0 have still "work in progress" status. We will publish a 5.0.0 version when we finish all our tasks and test it. About a Router error, You should wrap all your code with MDBNavLink component by from react-router-dom.

e.g

return (
  <Router>
    <MDBContainer>
      <MDBBtn onClick={this.sidenavToggle("Left")}>
        <MDBIcon size="lg" icon="bars" />
      </MDBBtn>
      <MDBSideNav slim fixed mask="rgba-blue-strong" triggerOpening={this.state.sideNavLeft} breakWidth={1300}
        className="sn-bg-1">
        <li>
          <div className="logo-wrapper sn-ad-avatar-wrapper">
            <a href="#!">
              <img alt="" src="https://mdbootstrap.com/img/Photos/Avatars/img%20(10).jpg" className="rounded-circle" />
              <span>Anna Deynah</span>
            </a>
          </div>
        </li>

        <MDBSideNavNav>
          <MDBSideNavLink to="/other-page" topLevel>
            <MDBIcon icon="pencil-alt" className="mr-2" />Submit listing</MDBSideNavLink>
          <MDBSideNavCat name="Contact me" id="contact-me" icon="envelope">
            <MDBSideNavLink>FAQ</MDBSideNavLink>
            <MDBSideNavLink>Write a message</MDBSideNavLink>
          </MDBSideNavCat>
        </MDBSideNavNav>
      </MDBSideNav>
    </MDBContainer>
  </Router>
);

Then everything will work ok.

Best, Kuba


rashesh patel commented 5 years ago

Hi Kuba,

I have wrap code with 'Router' where 'NavLink' is used but still, there is the same error came.

Is it possible to run my project with mdbreact version 4.18.1 (using my MDB pro token) till version 5 comes? So that there is no need to wrap code with 'Router'.

Thank you.


FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Closed

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.18.1
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No
Tags