Perfect Scroll bar error no element is specified to initialize PerfectScrollbar on windows

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",

3 Answers

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.

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

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.

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like