Running build with `npm`: ValidationError: Invalid configuration object.
See original GitHub issue- I’ve read the guidelines for Contributing to Roots Projects
- This request isn’t a duplicate of an existing issue
- I’ve read the docs and followed them (if applicable)
- This is not a personal support request that should be posted on the Roots Discourse community
Description
[Description of the issue]
Steps to reproduce
- [First step]
- [Second step]
- [and so on…]
Expected behavior: [What you expect to happen]
Actual behavior: [What actually happens]
Reproduces how often: [What percentage of the time does it reproduce?]
Versions
You can get this information from referencing CHANGELOG.md. Also, please include the OS and what version of the OS you’re running.
Additional information

Any additional information, configuration or data that might be necessary to reproduce the issue.
ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. │ │ - configuration[0].resolve.modules[2] should be a non-empty string. │ │ -> Folder name or directory path where to find modules.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)

Top Related StackOverflow Question
@retlehs: Correct. When I install the dependencies using
npm installsubsequent build will fail. When I (removenode_modulesand) install withyarn install, builds will work correctly.node6i can reproduce with
log:
and from the module resolutions listed in both
./.budfiles/profile.jsonand./.budfiles/bud/webpack.config.jsthere is anullvalue and then some straight up missing entries.looking at
node_modulesit appears that modules are not hoisted from@roots/bud-preset-*packages when runningnpm install. the solution, for now, is to install them as explicit peer dependencies:workaround
from a clean copy of
@roots/sagenow the build works and we can see expected module resolutions in the log:
Notes
explicitly installing
postcss@8.3.11is necessary because @roots/sage (the theme, not the bud preset) specifiespostcss@8.4.1but that’s not what@roots/bud-postcsswants.https://github.com/roots/sage/blob/759eb08030484742457b4790d983829eae675d6f/package.json#L31
if you don’t install
postcss@8.3.11npm will refuse to install anything unless you include the--forceflag:@QWp6t i’m not sure what is the best way forward to keep peer versions in sync between @roots/sage and @roots/bud to prevent issues with regards to npm peer package resolution requirements.
Moving forward
We could do any of the following:
@roots/dependenciesreports that npm is in use[requiring_extension_root]/node_modulesRefs
see also npm7 handling of peerDeps. relatedly, it would be nice if npm autoinstalled peerDependencies, which they are considering.