Please change the code in controller file as below **From:** ``` protected $_postFactory; public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $pageFactory, \Softadroit\Prescription\Controller\Index $postFactory ) { $this->_pageFactory = $pageFactory; $this->_postFactory = $postFactory; return parent::__construct($context); } ``` **To:** ``` public function __construct( \Magento\Framework\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $pageFactory ) { $this->_pageFactory = $pageFactory; return parent::__construct($context); } ``` After that run **php bin/magento setup:upgrade** And then you can run **php bin/magento setup:di:compile**