Webpack-encore: InvalidConfigurationException The child node "output_path" at path "webpack_encore" must be configured.

Created on 24 May 2019  路  5Comments  路  Source: symfony/webpack-encore

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

Most helpful comment

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'

All 5 comments

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!

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.

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'

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

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

Was this page helpful?
0 / 5 - 0 ratings