assetic icon indicating copy to clipboard operation
assetic copied to clipboard

Attempted to load class "Compiler" from namespace "Leafo\ScssPhp".

Open abelardolg opened this issue 5 years ago • 19 comments

Hi there,

I am using the package: "scssphp/scssphp": "^1.0.6"

When I delete vendor, var/cache and clear cache of composer, I run: composer install

then this message outputs:

Attempted to load class "Compiler" from namespace "Leafo\ScssPhp".           
  Did you forget a "use" statement for e.g. "Twig_Compiler", "Twig\Compiler",  
   "Symfony\Component\ExpressionLanguage\Compiler", "Symfony\Component\Depend  
  encyInjection\Compiler\Compiler" or "ScssPhp\ScssPhp\Compiler"? 

Then, I run the following command:

fgrep -R "use Leafo" vendor/

and I discovered that your package still uses Leafo/scss (this package was abandoned in favour of scssphp/scssphp):

vendor/kriswallsmith/assetic/src/Assetic/Filter/ScssphpFilter.php:use Leafo\ScssPhp\Compiler;
Operating System: Ubuntu 18.04.3 LTS 
            Kernel: Linux 5.3.0-26-generic
PHP 7.2.24-0ubuntu0.18.04.2 (cli) (built: Jan 13 2020 18:39:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies

What's wrong?

Best regards.

abelardolg avatar Feb 03 '20 09:02 abelardolg

This has been reported in pull request #892

robocoder avatar Feb 03 '20 14:02 robocoder

@abelardolg @robocoder This has been implemented in the 2.0 branch of assetic-php/assetic. Until we tag 2.0, you can pull it in by using "assetic/framework": "dev-2.0/dev" in your composer.json files.

LukeTowers avatar Feb 05 '20 18:02 LukeTowers

@LukeTowers , I have added these two lines inside my composer.json:

"scssphp/scssphp": "^1.0.6",
        "assetic/framework": "dev-2.0/dev"

Previously, I deleted var/cache, logs, composer cacheclear and vendor dir but it still continues showing me the same message.

Should I add some lines more inside another file (e.g. AppKernel)?

Any help would be welcome. Best regards.

abelardolg avatar Feb 06 '20 07:02 abelardolg

@abelardolg what's the full stack trace? Are you using ScssFilter? Do you still have kriswallsmith/assetic included?

See https://github.com/assetic-php/assetic/blob/2.0/dev/src/Assetic/Filter/ScssFilter.php

LukeTowers avatar Feb 06 '20 08:02 LukeTowers

Thanks for your tips. The full stack trace is attached. Yes, I am using ScssFilter. I have added kriswallsmith/assetic (kriswallsmith/assetic: "1.4.0"). trace.txt

abelardolg avatar Feb 06 '20 09:02 abelardolg

I commented the line where I inserted the reference to this package: kriswallsmith

but it still continues with the same issue:

Best regards.

abelardolg avatar Feb 06 '20 13:02 abelardolg

@abelardolg you need to remove the kriswallsmith reference from your composer and run composer update. If it's still present at all it will cause issues.

LukeTowers avatar Feb 07 '20 06:02 LukeTowers

@LukeTowers : thanks for your comment but I proceed to run the above steps but this time I run composer update (instead of composer install) but nothing happens: it remains same issue.

abelardolg avatar Feb 07 '20 07:02 abelardolg

@abelardolg please post your current composer.json

LukeTowers avatar Feb 07 '20 08:02 LukeTowers

composer.txt Best regards.

abelardolg avatar Feb 07 '20 08:02 abelardolg

Anybody could help me with this issue, please? Thanks in advance.

Best regards.

abelardolg avatar Feb 07 '20 09:02 abelardolg

@abelardolg the problem is that you're using symfony/assetic-bundle which pulls in this current library instead of the updated fork: https://github.com/symfony/assetic-bundle/blob/master/composer.json#L21.

You can try adding "assetic/framework": "dev-2.0/dev as 1.4" to your composer.json require property near the top, although you'll have to wait for @jaxwilko to update the name of the ScssFilter to ScssphpFilter.

LukeTowers avatar Feb 07 '20 09:02 LukeTowers

Ok, then I'll wait to download that library...when it is available.

Thanks for your help, time and effort.

Best regards.

abelardolg avatar Feb 07 '20 10:02 abelardolg

@LukeTowers @abelardolg the ScssFilter change has been merged into 2.0/dev :)

jaxwilko avatar Feb 07 '20 10:02 jaxwilko

Hi,

According to my attached composer.txt, what changes should I do?

Best regards.

abelardolg avatar Feb 07 '20 10:02 abelardolg

@abelardolg

try adding "assetic/framework": "dev-2.0/dev as 1.4" to your composer.json require property near the top

@JaxWilko can you submit a PR to the october rain library to update the reference? To the wip/laravel-6 branch please.

LukeTowers avatar Feb 07 '20 10:02 LukeTowers

I added that library on the top: "assetic/framework": "dev-2.0/dev as 1.4", "php": "^7.1", "symfony/symfony": "^3.4.2", "twig/twig": "^1.0||^2.0", "twig/extensions": "^1.5.0", "symfony/assetic-bundle": "~2.8", "symfony/swiftmailer-bundle": "~2.5", "symfony/monolog-bundle": "^3.1.0", "doctrine/doctrine-bundle": "^1.6", "doctrine/orm": "^2.5", "sensio/distribution-bundle": "^5.0.19", "incenteev/composer-parameter-handler": "~2.1", "ezsystems/ezpublish-kernel": "~7.0.0@dev", "ezsystems/repository-forms": "~2.0.0@dev", "ezsystems/ezplatform-solr-search-engine": "~1.5.0@dev", "ezsystems/ez-support-tools": "~0.2.0@dev", "ezsystems/ezplatform-http-cache": "~0.4.0@dev", "ezsystems/ezplatform-admin-ui": "~1.0.0@dev", "ezsystems/ezplatform-admin-ui-modules": "~1.0.0@dev", "ezsystems/ezplatform-admin-ui-assets": "~1.0.0@dev", "ezsystems/ezplatform-design-engine": "~1.1.0", "knplabs/knp-menu-bundle": "^2.1", "sensio/framework-extra-bundle": "^3.0.2", "willdurand/js-translation-bundle": "^2.6.4", "oneup/flysystem-bundle": "^2.0", "friendsofsymfony/jsrouting-bundle": "^1.4", "white-october/pagerfanta-bundle": "^1.1", "roave/security-advisories": "dev-master", "scssphp/scssphp": "^1.0.6"

but it nothing solves.

abelardolg avatar Feb 07 '20 11:02 abelardolg

@JaxWilko I think we might have to update the replace property of composer.json to reference 1.4 instead of *

LukeTowers avatar Feb 08 '20 06:02 LukeTowers

@abelardolg We've just released the 2.0 release that addresses a number of existing issues and dependency updates, see https://github.com/assetic-php/assetic/releases/tag/v2.0.0 for more information! Please try it out and let us know if you have any issues!

LukeTowers avatar Oct 11 '20 07:10 LukeTowers