Search code examples
symfony5

I cannot create entity with symfony 5 ~'ConsoleErrorEvent.php' failed to open stream: No such file or directory.~


create skelton

Php> composer create-project symfony/website-skeleton symfony-crud "5.1.*"
Php> cd symfony-crud
symfony-crud> php -S 127.0.0.1:8000 -t public

it's ok! enter image description here

next, I want to do 'crud' command

1.
symfony-crud> php bin/console make:crud
  [error] Error thrown while running command ""make:crud"". Message: "There are no commands defined in the "make" namespace.
  You may be looking for a command provided by the "MakerBundle" which is currently not installed. Try running "composer require symfony/maker-bundle --dev"."
  There are no commands defined in the "make" namespace.                                                                                                       
  You may be looking for a command provided by the "MakerBundle" which is currently not installed. Try running "composer require symfony/maker-bundle --dev". 

2.
symfony-crud> composer require symfony/maker-bundle --dev

3.
symfony-crud> php bin/console make:crud
  [ERROR] Missing packages: to use the make:crud command, run:
  composer require form validator twig-bundle orm-pack security-csrf annotations

4.
symfony-crud> composer require form validator twig-bundle orm-pack security-csrf annotations

next, database create using .env

DATABASE_URL=mysql://root:[email protected]:3306/symfony-crud

and do it console command.

symfony-crud> php bin/console doctrine:database:create
  Created database `symfony-crud` for connection named default

next, create 'Task' entity before 'crud' command.
occurs error is I add New property name.

symfony-crud> php bin/console make:entity Task

 created: src/Entity/Task.php
 created: src/Repository/TaskRepository.php

 Entity generated! Now let's add some fields!
 You can always add more fields later manually or by re-running this command.

 New property name (press <return> to stop adding fields):
 > title

In DebugClassLoader.php line 337:
                                                                                                                                                                    
  Warning: include(D:\OneDrive\ドキュメント\Project\Php\symfony-crud\vendor\composer/../symfony/console/Event/ConsoleErrorEvent.php): failed to open stream: No such file or directory                                                                                                                                              
                                                                                                                                                                    

make:entity [-a|--api-resource] [--regenerate] [--overwrite] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction]
 [-e|--env ENV] [--no-debug] [--] <command> [<name>]

What is this error
'ConsoleErrorEvent.php' failed to open stream: No such file or directory.


Solution

  • I tried in a directory that does not contain Japanese.

    Oh my goodness! The problem was garbled!