Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
abelardolg opened this issue Feb 3, 2020 · 19 comments · May be fixed by #897
Open

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

abelardolg opened this issue Feb 3, 2020 · 19 comments · May be fixed by #897

Comments

@abelardolg
Copy link

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
Copy link

This has been reported in pull request #892

@sad270 sad270 linked a pull request Feb 4, 2020 that will close this issue
@LukeTowers
Copy link

@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
Copy link
Author

@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
Copy link

@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
Copy link
Author

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
Copy link
Author

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

but it still continues with the same issue:

Best regards.

@LukeTowers
Copy link

@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
Copy link
Author

@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
Copy link

@abelardolg please post your current composer.json

@abelardolg
Copy link
Author

composer.txt
Best regards.

@abelardolg
Copy link
Author

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

Best regards.

@LukeTowers
Copy link

@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
Copy link
Author

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

Thanks for your help, time and effort.

Best regards.

@jaxwilko
Copy link

jaxwilko commented Feb 7, 2020

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

@abelardolg
Copy link
Author

Hi,

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

Best regards.

@LukeTowers
Copy link

@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
Copy link
Author

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
Copy link

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

@LukeTowers
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants