How to solve the problem “No tokens were provided” when running di compile in magento 2

Some times you have the problem with error message “No tokens were provided” when you try to run ssh command line “php bin/magento┬ásetup:di:compile”:

No tokens were provided

You can find where throught this problem by using command line:

grep -lr 'No tokens were provided' vendor/

You will see the resuls:

if (!$this->tokens) {
        throw new \Zend\Code\Exception\RuntimeException('No tokens were provided');

This problem happens when there are some empty files in your website. You can solve it by delete those files by using command line:

find ./ -size 0 -delete


find ./ -type f -empty -delete

Now, please run di compile again. Hope it works fine.

Add Comment

Required fields are marked *. Your email address will not be published.