cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot run compile: Undefined Offset error Filescanner.php

Cannot run compile: Undefined Offset error Filescanner.php

Hi, I'm using Magento 2.1.16 stuck on this error and haven't found anything on the forums or Google after hours of searching for a solution. 

 

Whenever I run the setup:di:compile command, I get this error: 

 

Notice: Undefined Offset 47 in /html/setup/src/Mag
ento/Setup/Module/Di/Code/Reader/FileScanner.php on line 72

 

I've tried clearing cache, and removing 3rd party modules / extensions.

 

I would greatly appreciate any help!

 

4 REPLIES 4

Re: Cannot run compile: Undefined Offset error Filescanner.php

Hello @JoshCMayorga 

 

using dependency injection, you don't end up using same class multiple times. Sharing some articles so please try if they can help you:

https://github.com/magento/magento2/issues/5629

https://www.queryxchange.com/q/10_141341/magento-2-error-during-compilation/

 

Please remove var folder and then run again compile command.

Manish Mittal
https://www.manishmittal.com/

Re: Cannot run compile: Undefined Offset error Filescanner.php

Thanks for the reply. I'm now getting this error after performing an upgrade and running the compile command: 

 

14% < 1 sec 60.0 MiBPHP Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN)

 

This is the file giving the error. I feel like this is out of my capacity level. Any hints? 

 

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * CatalogRule data helper
 */
namespace Themevast\MegaMenu\Helper;

class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
	public function addBodyClass()
	{
		echo "AAAAAAAAAAAAAAAAAAAAAA;
	}
}

Re: Cannot run compile: Undefined Offset error Filescanner.php

Hello @JoshCMayorga 

 

Replace 

echo "AAAAAAAAAAAAAAAAAAAAAA;

with 

echo "AAAAAAAAAAAAAAAAAAAAAA";
Manish Mittal
https://www.manishmittal.com/

Re: Cannot run compile: Undefined Offset error Filescanner.php

@JoshCMayorgaNot sure if you made the code changes. If you'll see the code snapshot you provided is missing closing quotes after "AAAAAAAAAAA. You need to have the string under start and closing double quotes to make it working.

 

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.