TypeError [ERR_INVALID_ARG_TYPE] when trying to build project using Yarn

Hi there.

I run into an issue when trying to compile my project using Yarn.

I have followed the instructions as seen here: (GitHub - roots/sage: WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and a modern development workflow)

PS C:\Users\super\Local Sites\hjallerup-marked\app\public\wp-content\themes\hjallerup> yarn build
yarn run v1.22.5
$ bud build
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at readFile (node:fs:393:10)
    at go$readFile (C:\Users\super\Local Sites\hjallerup-marked\app\public\wp-content\themes\hjallerup\node_modules\@roots\bud-support\lib\cjs\index.js:28298:14)
    at readFile (C:\Users\super\Local Sites\hjallerup-marked\app\public\wp-content\themes\hjallerup\node_modules\@roots\bud-support\lib\cjs\index.js:28295:12)
    at C:\Users\super\Local Sites\hjallerup-marked\app\public\wp-content\themes\hjallerup\node_modules\@roots\bud-support\lib\cjs\index.js:116224:12
    at new Promise (<anonymous>)
    at readFile (C:\Users\super\Local Sites\hjallerup-marked\app\public\wp-content\themes\hjallerup\node_modules\@roots\bud-support\lib\cjs\index.js:116223:14)
    at Object._readFile (C:\Users\super\Local Sites\hjallerup-marked\app\public\wp-content\themes\hjallerup\node_modules\@roots\bud-support\lib\cjs\index.js:83424:58)      
    at Object._readFile (C:\Users\super\Local Sites\hjallerup-marked\app\public\wp-content\themes\hjallerup\node_modules\@roots\bud-support\lib\cjs\index.js:116237:45)     
    at Manifest.read (C:\Users\super\Local Sites\hjallerup-marked\app\public\wp-content\themes\hjallerup\node_modules\@roots\bud\lib\cjs\context\manifest.js:10:33)
    at makeContext (C:\Users\super\Local Sites\hjallerup-marked\app\public\wp-content\themes\hjallerup\node_modules\@roots\bud\lib\cjs\context\index.js:31:58) {
  code: 'ERR_INVALID_ARG_TYPE'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I have edited my bud.config.js with my local project url

    /**
     * Target URL to be proxied by the dev server.
     *
     * This is your local dev server.
     */
    .proxy('http://hjallerup-marked.test')

    /**
     * Development URL
     */
    .serve('http://localhost:3000');

I’m at kinda stuck right now. Maybe someone can help me here.

Thanks.

what is your node version? and php selected for wordpress instalation in Local?

node -v

I’m using node version v16.13.1. I tried different version still nothing.

My local is using PHP version 8.0.0 - Also tried both 7.4.1 7.3.5

Hey @Mathias do you have Acorn installed?

I installed acorn in my theme. Should it be installed somewhere else?

Add it as plugin to your wordpress

Download .zip as your current php version then install in your wp and activate

Downgraded to PHP 7.4.1 and installed Acorn as plugin. Still getting the same error.

What kind of bud version have you installed?

I used ‘yarn add @roots/bud’ so i have the latest version 5.6.2

Could you show your .package.json file?

Yes here it is

{
  "name": "sage",
  "private": true,
  "browserslist": [
    "extends @wordpress/browserslist-config"
  ],
  "engines": {
    "node": ">=16.0.0"
  },
  "scripts": {
    "dev": "bud dev",
    "build": "bud build",
    "translate": "npm run translate:pot && npm run translate:js",
    "translate:pot": "wp i18n make-pot . ./resources/lang/sage.pot --ignore-domain --include=\"app,resources\"",
    "translate:js": "wp i18n make-json ./resources/lang --pretty-print"
  },
  "devDependencies": {
    "@roots/bud": "^5.6.2",
    "@roots/bud-tailwindcss": "5.6.2",
    "@roots/sage": "5.6.2"
  }
}

Change

"@roots/bud": "^5.6.2",

to

"@roots/bud": "5.6.2",

then yarn && yarn build

Did both. Still getting the same error.

Edit: Tried doing a fresh install doing all the steps mentioned and running yarn bud build.
Still getting the same error

If you use Local, your proxy url shouldn’t be http://hjallerup-marked.local ?

.proxy(‘http://hjallerup-marked.local’)

All my projects is using test as end
image

Ok so it’s strange it looks you have everything properly configure

Yeah i’m at a complete loss. The error seems to be connected to bud.
I’m not sure though.

Last thing, in this above screenshot this some other domain not this current which you have on proxy.

hjallerup.test

.proxy(‘http://hjallerup-marked.test’)

Still getting the same error.

I’m now sure it’s Bud. Every command i do from bud is giving me the same error.

yarn bud build
yarn bud -h
yarn bud doctor
yarn bud clean
etc.

Are you using WSL? That’s the only officially supported method for using Sage stuff in Windows.

1 Like