No such file or directory


#1

Hi, I’m trying to make an add-on for Local but I’ve getting this error:

/bin/sh: /Applications/Local: No such file or directory

I think the issue is with this line of code here: https://github.com/danieltj27/Local-Addon-Git/blob/master/src/git-info.js#L41

It’s based off of this tutorial here: https://deliciousbrains.com/creating-custom-addon-local-flywheel/

Any help please? I’m new to React and my JavaScript know-how is limited, I was hoping to jump in and learn a thing or two but I’m stuck.


#2

Hey @danieltj27

That error looks like what happens when a shell command breaks on whitespace. That line you linked to looks like this:

let command = `${context.environment.dockerPath} exec ${site.container} git status --path=/app/public --allow-root`

I haven’t tried this, but I think what you need to do is wrap the shell variable(s) in double quotes, so change that line to:

let command = `"${context.environment.dockerPath}" exec "${site.container}" git status --path=/app/public --allow-root`

In this specific case, I don’t think you need double quotes around ${site.container} but it’s a good habit to get into with Bash vars.

Let me know if that helps, or if you have any other questions!