I installed a fresh version of Ubuntu 18.04 on my optimus laptop then I followed the instructions from this site to install the bumblebee package.
It succeeded but I saw a line during the installation which stated that it couldn't remove the nouveau module. I did a reboot and I ran
optirun --status to see if it's working and it outputted that discrete nvidia card is disable, then I tried running
optirun glxgears and this error message came up.
[ERROR]Cannot access secondary GPU - error: [XORG] (EE) Failed to load module "mouse" (module does not exist, 0)
I have tried reinstalling Ubuntu and bumblebee.
I have an NVidia Geforce 940MX card.