5

I am getting this error on server start on react js.

Error: no element is specified to initialize PerfectScrollbar

However it is working fine on friend MAC OS. I am using windows.

I am using this version: "perfect-scrollbar": "^1.4.0",

Asad Khan
  • 473
  • 1
  • 8
  • 21

3 Answers3

6

Quite old question but I'll post my solution since I had the same problem. I was having the same error message:

Error: no element is specified to initialize PerfectScrollbar

In my case, it seems that I was calling PerfectScrollbar on an element that didn't exist. I had:

const asideBody = new PerfectScrollbar('.aside-body', {
    suppressScrollX: true
});

And I was having the error in the pages I didn't have any element in the DOM with class="aside-body".

So I managed to only call PerfectScrollbar in the appropriate pages.

groovyDynamics
  • 63
  • 1
  • 3
  • 8
0

Yes that was the issue that i was calling PerfectScrollbar on an element that didn't exist. I know its not a proper solution but i removed these errors by giving those undefined classes to an empty span. So now it does not bother me any more.

0

For me the solution was to add condition on the calling function verifying element is defined

Asaf M
  • 274
  • 2
  • 9