Setting a 'base' parameter with trailing slash breaks build with "/usr/local/bin/build: no such file or directory"

I am trying to use the base parameter to build from a subdirectory, it’s not going well:

    4:28:49 PM: Build ready to start
    4:28:52 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
    4:28:52 PM: build-image tag: v3.3.2
    4:28:52 PM: buildbot version: 75cd99f62ada9e21edea53208e8baf0eab85a045
    4:28:52 PM: Fetching cached dependencies
    4:28:52 PM: Starting to download cache of 255.0KB
    4:28:52 PM: Finished downloading cache in 96.613421ms
    4:28:52 PM: Starting to extract cache
    4:28:52 PM: Failed to fetch cache, continuing with build
    4:28:52 PM: Starting to prepare the repo for build
    4:28:53 PM: No cached dependencies found. Cloning fresh repo
    4:28:53 PM: git clone
    4:28:55 PM: Preparing Git Reference refs/heads/master
    4:28:56 PM: Starting build script
    4:28:56 PM: failed during stage 'building site': fork/exec /usr/local/bin/build: no such file or directory
    4:28:56 PM: Build command unable to start

My base parameter is set to packages/aaron/example which holds its own package.json file so it should be ok. But it’s clearly not.

As this is a monorepo, I’m not sure it’s related to this issue, but clearing the build cache makes no difference whatsoever.

Does anyone have any experience with running the build from a subdir?

Note: This is the repo:

Hi @joostdecock, what build command are you using? Seems like it’s not finding your build command.

The build command is npm run build. Seem kinda hard not to find that one :slight_smile:

We worked through this in the helpdesk and I think your build is working now, right @joostdecock? The problem isn’t obvious here since you didn’t but in our UI you could see that there was a setting with a // in the path, which had a bad interaction with our build script leading to that cryptic error message.

Once that was fixed the build seemed to me to work.

Thanks for your efforts, but unfortunately the build is not working (the problem remains the same).
The deploy that is/was published is one I build on my machine and then deployed manually from the CLI.

The problem isn’t obvious for me either :wink: but I appreciate the link to the build script. I’ll see if I can replicate this on my machine.

I don’t see a // in the UI. Do you remember where it was that you saw that?

It was in the publish directory as I said to you yesterday in the helpdesk, and I also believe that your build will work now if you retry it as I mentioned. I didn’t see a response in that thread in the helpdesk - maybe you missed my reply?

At any rate I was awaiting you to trigger a new deploy from git so we can see how it behaves :slight_smile:

Please forgive me, I somehow completely missed that reply. Sorry about that.

Ok, first the good news: It builds now :slight_smile:

The bad news is that the edit widget is indeed causing issues (and I assume it’s the reason we had that double slash there in the first place).

I’ve taken a screenshot of the settings as I found them after you change the path in the DB:

Looks good. But when I click edit I get this:

Now I didn’t click Save, but I guess it’s save to assume that doing so would break things again.

Which might also mean that if I create another site for a different subdirectory (which seems to be the only way to handle a monorepo with multiple builds in subdirectories) I’m going to find myself in the same situation where I can’t change that value.

Perhaps I can setup a new site, and try to recreate the issue. That might help to understand what exactly triggers this issue, and how to sidestep it.
My money is on changing the name of the build directory to something else than build as that’s perhaps tripping up some regular expression somewhere :slight_smile:

Either way, thank you for your great support.

Ok, I think I figured it out :slight_smile:
I looked at the source of that edit widget, as I thought it was somehow getting things messed up.
However, looking at it, it’s obvious that the prefixed part is there on purpose:

<span class="affix prefix">packages/aaron/example/</span>

That is obviously intended as the prefix. So that’s when I realized that the build directory is prefixed with the base directory. And my base directory (see the screenshot in my previous answer) has a trailing slash.

So that explains the double slashes. It also means that rather than packages/aaron/example/build I should use build as the publish directory.

I updated the settings like that:

When I edit them now, things look as expected:


  • For me, the matter is resolved
  • I think the trouble started because there was a trailing slash in the base directory
  • I think stripping any trailing slashes from the base directory might be a good improvement to prevent others getting confused
  • I have renamed this topic to Setting a ‘base’ parameter with trailing slash breaks build with “/usr/local/bin/build: no such file or directory as that better captures the issue

Thank you for all your help. Much appreciated!



Wow, what thorough investigation, good sleuthing, and great suggestions, Joost! I’ll get this feedback in front of our front-end team!

So glad to hear you got things sorted but don’t hesitate to ping back in case you have more trouble in the future.

1 Like

Also wanted to let you know we got an issue filed to improve this :slight_smile:

1 Like