skip to Main Content

I created a new project with the

composer create-project --prefer-dist laravel/laravel test-web

command. When I tried to use the php artisan tinker to test some stuff described in the documentation I got the following non-stop appearing error:

PHP Error: Class 'Psy/ShellOutput' not found in C:/Users/Development/Projects/laravel/test-web/vendor/psy/psysh/src/Shell.php on line 374

It kept flooding the command line until I pressed CTRL+C

I haven’t found anything related with the error in the web. I also checked the files of the class were there, used composer update, tried laravel new test-web-2 and nothing.

Running php artisan tinker in an older project doesn’t give me any error so I think it is about a newer version maybe?
Is there a way to make it work?
I am running it on Windows 10, PHP 7.3.3

3

Answers


  1. This could be a number of things, depending on what (if anything) you’ve added to the base distro… but a couple of things I’ve run into that might help you are:

    Clear out the composer autoload cache:

    composer dump-autoload
    

    If this doesn’t help, it is possibly a namespace/use issue. If you have added any new classes that tinker may be trying to access, make sure the namespace matches the use statement in any class that uses it.

    So, if class Foo is namespaced like so:

    namespace AppStuffFoo;
    

    make sure that any other class that uses it pulls it in with the correct namespace:

    use AppStuffFoo;
    

    Edit:

    Per the OP’s comment below, it appears that the use clause is indeed the culprit. It is possible that the latest version is missing the following line in:

    /vendor/psy/psysh/src/Shell.php

    use PsyOutputShellOutput;
    

    For others coming to this question: While this will repair the issue temporarily, it is not recommended to make changes to the vendor files; the next time you update this via composer, it may overwrite your changes. You may be better served to revert to a stable version until the package is sorted.

    Login or Signup to reply.
  2. I got this problem after a fresh installation too, but when I try with another project that just created earlier it didn’t have this error.

    my solution is add

    use PsyOutputShellOutput;

    in

    /vendor/psy/psysh/src/Shell.php

    Login or Signup to reply.
  3. PsySH v0.9.10 had a bug—a missing use statement, thanks to a botched git rebase—and there was about a twenty minute window where installing it would pick up that version. composer update should get you v0.9.11 which is certified bug free! (at least from that bug 🙂)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search