У меня странная проблема.
Я использую Symfony Flex и работаю над существующим проектом. Я пытаюсь установить webpack-encore-bundle с помощью следующей команды:
composer require symfony/webpack-encore-bundle
Тогда я получаю это:
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.2.*"
Package operations: 1 install, 0 updates, 0 removals
- Installing symfony/webpack-encore-bundle (v1.6.2): Loading from cache
Package symfony/webpack-encore-pack is abandoned, you should avoid using it. Use symfony/webpack-encore-bundle instead.
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 1 recipe (8e557491367cda509fceebb187833635)
- Configuring symfony/webpack-encore-bundle (>=1.0): From github.com/symfony/recipes:master
Executing script cache:clear [OK]
Executing script assets:install --symlink --relative public [OK]
Some files may have been created or updated to configure your new packages.
Please review, edit and commit them: these files are yours.
Тогда я бегу:
yarn install
И я получаю это:
yarn install v1.16.0
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > sass-loader@7.1.0" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 2.39s.
Кажется, все в порядке. Сейчас я обновляю проект и получаю это:
ClassNotFoundException
Attempted to load class "WebpackEncoreBundle" from namespace "Symfony\WebpackEncoreBundle".
Did you forget a "use" statement for another namespace?
Итак, вот что у меня есть в bundles.php:
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
В composer.json у меня есть:
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
Я бегу:
yarn encore dev
Он успешно компилируется, но у меня есть та же ошибка.
Я также попробовал эту команду:
composer remove symfony/webpack-encore-bundle
Тогда я попробую еще раз
composer require symfony/webpack-encore-bundle
Тогда мы получили ту же ошибку, и этот цикл никогда не заканчивается.