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 class="aside-body".

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

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

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest