symfony / webpack-encore

A simple but powerful API for processing & compiling assets built around Webpack
https://symfony.com/doc/current/frontend.html
MIT License
2.23k stars 197 forks source link

InvalidConfigurationException The child node "output_path" at path "webpack_encore" must be configured. #579

Open ivanovnickolay opened 5 years ago

ivanovnickolay commented 5 years ago

I created a new project Symfony 4.2.8 (PHP 7.3.4). Transferred files from the old project (on PHP 7.1). When I try to open a site page, I get an error. InvalidConfigurationExceptionThe child node "output_path" at path "webpack_encore" must be configured. in ArrayNode.php line 228

I decided to reinstall the encore (composer require encore). Composer issued an error require encore Using version ^1.5 for symfony/webpack-encore-bundle ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Package symfony/annotations-pack is abandoned, you should avoid using it. No replacement was suggested. Package symfony/lts is abandoned, you should avoid using it. Use symfony/flex instead. Generating autoload files ocramius/package-versions: Generating version class... ocramius/package-versions: ...done generating version class Executing script cache:clear [KO] [KO] Script cache:clear returned with error code 1 !! !! In ArrayNode.php line 228:

What to do to solve this problem? Thank you in advance

Kocal commented 5 years ago

Hi, it seems you have already configuration for the webpack-encore-bundle without having installed.

Try to remove the file config/packages/webpack_encore.yaml, re-run composer require encore, and that should do the work!

robert611 commented 5 years ago

I have the same problem, but I do not have file webpack_encore.yaml in config/packages. I do not know where look for this file with output_path.

Evgeny1973 commented 5 years ago

Make config/packages/webpack_encore.yaml Content:

webpack_encore:

The path where Encore is building the assets.

# This should match Encore.setOutputPath() in webpack.config.js.
output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false

# if using Encore.enableIntegrityHashes() specify the crossorigin attribute value (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous'

# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes).
# To enable caching for the production environment, creating a webpack_encore.yaml in the config/packages/prod directory with this value set to true
# Available in version 1.2
#cache: 'false'
robert611 commented 5 years ago

Evgeny1973, I created file like you said and copied configuration from symfony doc and that helped, thank you.

Astro-Otter-Space commented 3 years ago

I've often this error when i have bad configuration in a yml file. The true error is elsewhere. So to find the true error, in Symfony 3.4, var_dump the exception in AppKernel, method registerContainerConfiguration

soufian-ze commented 1 year ago

Evgeny1973, I created file like you said and copied configuration from symfony doc and that helped, thank you.

Can you share the code please