Roots Discourse

Bud build error

Hello , I tried to follow the steps as it in here :

master branch , and gives this error :

│ 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.                                                                               │
│                                                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@Al_Sherif_Ahmed_Khal please don’t just post an error message without context.

  1. What version of Sage are on you on? Have you made any changes?
  2. What version of Node are you running?
  3. Exactly what commands did you run to get the error you provided?
  1. What version of Sage are on you on? Have you made any changes?
    Sage 10

I used :

$ composer create-project roots/sage your-theme-name dev-master

After that :
cd your-theme-name

Then :

yarn

after that :

yarn dev

My node version is : v16.13.0

then this error appears :

I googled for this error but I can’t find any related info ,

[C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one] [build] » ✖  TypeError: config.entry(...).resolve is not a function
    at module.exports (C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one\bud.config.js:20:6)
    at Configuration.<anonymous> (C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one\node_modules\@roots\bud\lib\cjs\cli\Runner\config\dynamic.config.js:81:23)
    at Generator.next (<anonymous>)
    at C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one\node_modules\tslib\tslib.js:117:75
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one\node_modules\tslib\tslib.js:113:16)
    at Configuration.invoke (C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one\node_modules\@roots\bud\lib\cjs\cli\Runner\config\dynamic.config.js:71:38)
    at Configuration.<anonymous> (C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one\node_modules\@roots\bud\lib\cjs\cli\Runner\config\dynamic.config.js:33:28)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one\node_modules\tslib\tslib.js:114:62)
[C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one] [bud.api] » …  Executing 6 enqueued functions
[C:\Users\AlSherif Khalaf\Local Sites\store\app\public\wp-content\themes\new-one] [bud.api] » ❯  executing alias [{"@fonts":"C:\\Users\\AlSherif Khalaf\\Local Sites\\store\\app\\public\\wp-content\\themes\\new-one\\resources\\fonts","@images":"C:\\Users\\AlSherif Khalaf\\Local Sites\\store\\app\\public\\wp-content\\themes\\new-one\\resources\\images","@scripts":"C:\\Users\\AlSherif Khalaf\\Local Sites\\store\\app\\public\\wp-content\\themes\\new-one\\resources\\scripts","@styles":"C:\\Users\\AlSherif Khalaf\\Local Sites\\store\\app\\public\\wp-content\\themes\\new-one\\resources\\styles"}]

I can’t tell, are you trying to build Bud within a WSL instance or not? If not, can you please try from WSL?

1 Like

I will try using WSL

Thanks a lot ,
It is working now fine with little problem

: Error occured while trying to proxy: localhost:3000/

[sage] [bud.server] › ✖  [HPM] Error occurred while proxying request localhost:3000/ to http://store.local/ [ECONNREFUSED] (https://nodejs.org/api/errors.html#errors_common_system_errors)
[sage] [bud.server] › ✖  [HPM] Error occurred while proxying request localhost:3000/favicon.ico to http://store.local/ [ECONNREFUSED] (https://nodejs.org/api/errors.html#errors_common_system_errors)


my bud.confing.js :

/**
 * @typedef {import('@roots/bud').Bud} Bud
 *
 * @param {Bud} config
 */

module.exports = async (config) =>
  config
    /**
     * Application entrypoints
     *
     * Paths are relative to your resources directory
     */
    .entry({
      app: ['scripts/app.js', 'styles/app.css'],
      editor: ['scripts/editor.js', 'styles/editor.css'],
      customizer: 'scripts/customizer.js',
    })

    /**
     * These files should be processed as part of the build
     * even if they are not explicitly imported in application assets.
     */
    .assets(['assets/images'])

    /**
     * These files will trigger a full page reload
     * when modified.
     */
    .watch([
      'tailwind.config.js',
      'resources/views/*.blade.php',
      'app/View/**/*.php',
    ])

    /**
     * Target URL to be proxied by the dev server.
     *
     * This is your local dev server.
     */
    .proxy({target: 'http://store.local'});

I have the same issue, building inside a WSL 2 instance on Linux file system.

✖  @roots/bud-postcss manifest cannot be resolved
rendering dashboard

    ValidationError: Invalid configuration object. Webpack has been initialized using a configuration
    object that does not match the API schema.
     - configuration[0].resolve.modules[4] should be a object { alias?, aliasFields?, byDependency?,
    cache?, cachePredicate?, cacheWithContext?, conditionNames?, descriptionFiles?, enforceExtension?,
    exportsFields?, extensions?, fallback?, fileSystem?, fullySpecified?, importsFields?, mainFields?,
    mainFiles?, modules?, plugins?, preferAbsolute?, preferRelative?, resolver?, restrictions?, roots?,
    symlinks?, unsafeCache?, useSyncFileSystemCalls? }.
       -> Folder name or directory path where to find modules.
✖  @roots/bud-postcss manifest cannot be resolved

Edit: Alright, so in my case I had to install the packages using yarn, not npm.
yarn installs the packages differently than npm.

1 Like

Running on windows 10, installed packages with yarn

Still this error:

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.

Have you removed the node_modules/ folder before?
Are you running the build script with npm or with yarn?

  1. yarn - to install packages
  2. yarn dev - to run dev but it gives error

node -v 17.2.0 (also tried with 16.3)
npm -v 8.2.0

have tried deleting node_modules folder and then yarn again to install modules.
also tried to install packages with npm install but no luck

Hm, and you created the Sage 10 theme from latest master (dev-master), not a 10* release tag?

yes

composer create-project roots/sage your-theme-name dev-master

This topic is already solved :sweat_smile:

One really critical piece of information is missing - are you using WSL or not? If you’re not using WSL, then you’re gonna need to use WSL.

If you’re still experiencing this issue with WSL, let’s get a new topic started with more details about your setup please!