37 votes
Accepted

Magento 2.3.3 Fails on magento setup:di:compile with an error mentioning InvoiceFlexFieldProcessorInterface

Go to Below File /vendor/vertex/module-tax/Model/FlexField/Processor/OrderCurrencyGetterProcessor.php At the end of the "use" clauses in add the following two lines: use Vertex\Tax\Model\...
Rakesh Donga's user avatar
  • 5,344
36 votes

Cannot declare interface , because the name is already in use

Today I received the same-type error: PHP Fatal error: Cannot declare class Class\Name\Here , because the name is already in use in /var/www/m2/magento2/app/code/path/to/the/class.php on line 100 ...
Siarhey Uchukhlebau's user avatar
36 votes

M2/ How to fix "Incompatible argument type: Required type: string. Actual type ..."

The error Incompatible argument type: Required type: string. Actual type: \SkyFox\Supplier\UI\DataProvider\Supplier\name; File is triggered because of the missing type in the __construct phpDoc ...
Ashish Raj's user avatar
  • 1,325
31 votes
Accepted

Magento2 - setup:di:compile

The command setup:di:compile command generates the contents of the var/di folder in Magento <2.2 and generated for Magento >= 2.2 According to Magento, this serves the following purpose: ...
Tjitse's user avatar
  • 1,300
30 votes
Accepted

Which compilation commands are needed in developer mode and when?

pay attention: I've experienced that in developer mode deleting the pub/static will break the mechanism because you get rid of the .htaccess file that makes the magic in that folder. If you keep the ...
Alessandro Ronchi's user avatar
25 votes

Notice: unserialize(); Error at offset in Magento 2.2

Inject \Magento\Framework\Serialize\Serializer\Json class for serialize and unserialize values. protected $serialize; public function __construct( ... \Magento\Framework\Serialize\Serializer\...
Prince Patel's user avatar
  • 22.7k
23 votes

Magento 2 - setup:di:compile throws No tokens were provided error

I experienced this problem and put breakpoints on each instance of 'No tokens were provided' I could find using: grep -lr 'No tokens were provided' vendor/ which returned: vendor/zendframework/...
Andrew C. Stayart's user avatar
20 votes

Classnames 'Void' inside vendor/magento/

Here is how to fix it: edit vendor/magento/module-sales/etc/webapi.xml line 112: - <route url="/V1/invoices/:id/void" method="POST"> + <route url="/V1/invoices/:id/voidInvoice" method="POST"...
Konstantin Gerasimov's user avatar
17 votes

Magento2 - setup:di:compile

It's not mandatory to run setup:di:compile command everytime but if you have done any code change specially with factory methods ,proxy, add plugins or any code compilation then you must need to run ...
Prince Patel's user avatar
  • 22.7k
16 votes

Magento 2.3.3 Fails on magento setup:di:compile with an error mentioning InvoiceFlexFieldProcessorInterface

I run into the same problem. It seems only a speeling problem: https://github.com/magento/magento2/issues/24930#issuecomment-543949135 So it is better to change only the namespace spelling without ...
Mario's user avatar
  • 405
12 votes
Accepted

Magento 2: Run setup:di:compile a Specific Module

You can do this by follow this step : Go to : /var/www/html/YourMagento/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php Find this line : $modulePaths = $this->componentRegistrar->...
Rohan Hapani's user avatar
  • 17.4k
11 votes
Accepted

Magento 2: Why di compile is not 100%?

As per my understanding. The whole process of setup:di:compile is divided into the 7(100%) sub code generations process. Proxies(1/7) Repositories(2/7) Service(3/7) Application(4/7) ...
Manthan Dave's user avatar
  • 9,816
10 votes

Magento 2 - setup:di:compile throws No tokens were provided error

Here, if you want to know HOW to find those empty files, just run this command (assuming you have linux, and access to the shell) in your magento root directory, or whatever directory you are working ...
CarComp's user avatar
  • 1,246
10 votes
Accepted

Disable setup:di:compile

You don't need to run it. You can simply delete the directories under var/generation (or under generated/ after 2.2). Be careful not to the delete the .htaccess file. You only really ever need to do ...
Shawn Abramson's user avatar
10 votes

Magento2 which command Run and when to Run

Cleaning a cache type deletes all items from enabled Magento cache types only. In other words, this option does not affect other processes or applications because it cleans only the cache that Magento ...
Shoaib Munir's user avatar
  • 9,414
8 votes

setup:di:compile error because of duplicated class of data-migration-tool

A more direct answer to this problem is: At the top of the file: {magento-base}/vendor/magento/data-migration-tool/tests/unit/testsuite/Migration/Step/UrlRewrite/Version11410to2000Test.php Replace: ...
iJeep's user avatar
  • 621
8 votes
Accepted

Magento 2: Error during compilation Incompatible argument type

This is because your parent constructor has redundant arguments or not correct . In your case, need to remove arguments: $storeManager and $metadataPool. app\code\Custom\Module\Model\ResourceModel\...
Khoa TruongDinh's user avatar
7 votes

Magento 2.3.3 Fails on magento setup:di:compile with an error mentioning InvoiceFlexFieldProcessorInterface

If like me you can't edit the file (because our CD will fail) follow these steps: In the root of your project, create a directory patches/composer Create a file called vendor-vertex-compilation-issue....
Haim's user avatar
  • 2,144
7 votes
Accepted

How Can I resolve Amasty\Base compatible with Monolog\Formatter\LineFormatter::format(array $record) In MAgento 2?

In this file you have to change 1 line You have to replace your public function line as below. public function format(array $record): string Also check updated file code as below. Please copy and ...
Monark Bhawani's user avatar
6 votes
Accepted

Uncaught TypeError: Argument 1 passed to [...] must be an instance of

I found that in the LN module 2 different namespace declarations was used: Layerednavigation and LayeredNavigation. When code is compiled all di class arguments was stored in the array where the class ...
Siarhey Uchukhlebau's user avatar
6 votes

Blank screen after compiling

Just follow : to debug blank white screen and CSS,JS page load design issue. open terminal run following command cd magento-root-folder php bin/magento setup:upgrade then don't compile just ...
lalit mohan's user avatar
  • 1,075
6 votes

Vertex generation doesn't exist ...?

It's happening because of the Redis cache, run these commands to flush it and try again. redis-cli -n 0 flushall php -r "echo opcache_reset();" bin/magento setup:di:compile
Rafael Corrêa Gomes's user avatar
6 votes
Accepted

Magento2 which command Run and when to Run

Although question have already been answered and accepted as well, but i thought it would be nice to compile all points in single answer for better understanding and for other users who are searching ...
Naveed Asim's user avatar
  • 3,637
6 votes

Magento 2 : Issue on setup:di:compile

If this happens regularly when you initiate compile and you're confident you have no errors I've found simply running php bin/magento setup:di:compile a second time will be successful.
Michigan Websites's user avatar
6 votes

DI compile step fails after update to 2.3.5

Please verify your PHP version. I encountered the same issue while on PHP 7.1. Switching to PHP 7.2 resolved this error. Good luck!
Swap's user avatar
  • 61
5 votes
Accepted

Magento 2: Error during compilation

Try with below code, Remove var folder and run command of compile, class BuyingListIndex extends \Magento\Framework\View\Element\Template { public function __construct( \Magento\Framework\...
Rakesh Jesadiya's user avatar
5 votes

Which compilation commands are needed in developer mode and when?

Just to clarify between the three different modes (source: Magento U Fundamentals course). In bold, the specific points related to your question. Developer mode Static file materialization is not ...
Raphael at Digital Pianism's user avatar
5 votes

Disable setup:di:compile

You should not run setup:di:compile in developer mode! This command need only for production mode.
KAndy's user avatar
  • 20.8k
5 votes
Accepted

Classnames 'Void' inside vendor/magento/

I don't think Magento 2 is yet compatible with php 7.1-alpha, but this is an alarm signal. I think you should report this on github. It could be an issue in the near future,
Marius's user avatar
  • 198k
5 votes

Magento 2 - setup:di:compile throws No tokens were provided error

Seems you have an empty file which is parsed by the \Magento\Setup\Module\Di\Code\Reader\ClassesScanner, which uses the PHP token_get_all method. The exception is thrown, if the method does not return ...
casdero's user avatar
  • 51

Only top scored, non community-wiki answers of a minimum length are eligible