kriswallsmith / assetic

Asset Management for PHP
MIT License
3.76k stars 559 forks source link

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

Open abelardolg opened 4 years ago

abelardolg commented 4 years ago

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.

robocoder commented 4 years ago

This has been reported in pull request #892

LukeTowers commented 4 years ago

@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.

abelardolg commented 4 years ago

@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.

LukeTowers commented 4 years ago

@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

abelardolg commented 4 years ago

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 commented 4 years ago

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

but it still continues with the same issue:

Best regards.

LukeTowers commented 4 years ago

@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.

abelardolg commented 4 years ago

@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.

LukeTowers commented 4 years ago

@abelardolg please post your current composer.json

abelardolg commented 4 years ago

composer.txt Best regards.

abelardolg commented 4 years ago

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

Best regards.

LukeTowers commented 4 years ago

@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.

abelardolg commented 4 years ago

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

Thanks for your help, time and effort.

Best regards.

jaxwilko commented 4 years ago

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

abelardolg commented 4 years ago

Hi,

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

Best regards.

LukeTowers commented 4 years ago

@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.

abelardolg commented 4 years ago

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.

LukeTowers commented 4 years ago

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

LukeTowers commented 3 years ago

@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!