"make all" exited with code 0. Shutting down Netlify Dev server

Site name: badmintondoubles

Hi,

When I add this build command to my local netlify.toml:

[dev]
command = “make all” # Command to start your dev server

I get an error, after the build process (which builds what’s needed, though it had nothing to build this time):

netlify dev
◈ Netlify Dev ◈
◈ Injecting environment variable values for all scopes
◈ Ignored general context env var: LANG (defined in process)
◈ No app server detected. Using simple static server
◈ Running static server from "badmintondoubles.com/public"
◈ Setting up local development server
make[1]: Entering directory '/home/s6mike/git_projects/badmintondoubles.com'
make public
make[2]: Entering directory '/home/s6mike/git_projects/badmintondoubles.com'

◈ Static server listening to 3999
make[2]: Nothing to be done for 'public'.
make[2]: Leaving directory '/home/s6mike/git_projects/badmintondoubles.com'
make[1]: Leaving directory '/home/s6mike/git_projects/badmintondoubles.com'
◈ "make all" exited with code 0. Shutting down Netlify Dev server
make: *** [makefile:29: dev] Error 1

The same build command works fine when I deploy everything to netlify online, this has to build everything so this screenshot only shows the end of the build process:

I’ve tried added the make flag which hides the ‘leaving directory’ messages (in netlify.toml), but this didn’t fix the issue.

My full netlify.toml:

[[redirects]]
  from = "/badmintondoubles.com/*"
  to = "/:splat"

[[redirects]]
  from = "/wp-content/uploads/complianz/css*"
  to = "/wp-content/plugins/complianz-gdpr/assets/css/:splat"
  status = 302 # 200 rewrite?

[build]
  publish = "public/" # The path to your static content folder
  command = "make all" # Command to start your dev server

[dev]
  command = "make all" # Command to start your dev server  autoLaunch = false # a Boolean value that determines if Netlify Dev launches the local server address in your browser
  publish = "public/" # The path to your static content folder

I’m assuming my makefile content is not relevant since it runs successfully on dev, but I can provide that if desired.

Thanks!

Mike

BTW, I also read:

a) Build commands exit with code 0 but site doesn't finish deploying and times out
b) Cannot run netlify dev locally

You’re welcome to trigger a build, as was suggested for (a), but since my issue is with the dev build I assume that won’t help you.

b) seemed to be solved by adding a framework, but since I’m just using make and bash scripts to build my html, I guess that isn’t relevant either.

Here is the makefile in case it’s useful. It calls a separate script compile_template.sh, which runs a few sed commands.

# Avoids collisions with filenames
.PHONY: all dev public prints clean

# Stops intermediate files being deleted (e.g. content/X.html)
.SECONDARY:

# Define variables
# := simple, assigned once

CONTENT_DIR := content
PUBLIC_DIR := public
TEMPLATE := badmintondoubles-template-main.html

CONTENT_FILES := $(shell [ -d $(CONTENT_DIR) ] && find $(CONTENT_DIR) -iname "*.html" -type f)

PUBLIC_FROM_CONTENT := $(foreach file,$(CONTENT_FILES),$(patsubst $(CONTENT_DIR)/%,$(PUBLIC_DIR)/%,$(file)))

###########

all:
  make public

public: $(PUBLIC_FROM_CONTENT)

dev:
  make all
  netlify dev

clean:
  find $(PUBLIC_DIR) \( -type f -iname "*.html" -o -type d -empty \) -not -path "$(PUBLIC_DIR)/wp-json/*" -delete

############

# Compiles full html output in public/ from content/ + template

$(PUBLIC_DIR)/%.html: $(CONTENT_DIR)/%.html badmintondoubles-template-main.html
  $(info Compiles content + template > public)
  mkdir -p $(@D)
  ./compile_template.sh $< $@ $(TEMPLATE)

Heya @s6mike - thanks for being so thorough in your report!

I had the long below written up but it seems like maybe you’ve fixed things in the meantime? I see a few successes, and befoer that the last build as failing - Netlify App due to the lighthouse plugin instead of anything to do with Make AFAICT).


I am not a Makefile expert (nobody on our Support team is, though I suppose I’ve probably used it more than anyone else since I am a longtime unix user), but if I am reading your file correctly, make all just does this, right?

$(foreach file,$(CONTENT_FILES),$(patsubst $(CONTENT_DIR)/%,$(PUBLIC_DIR)/%,$(file)))

I wonder if that command is failing? Maybe you could turn it into a shell script instead so we can debug it more easily - specifically by using set -x:

#!/bin/sh
set -x

<do that thing>

(I am not clear if foreach is a make primitive, since last time I used it it was in csh which is AFAICT not even installed in our build image, so you may have to do something more like:

for i in files/* ; do sed -is/${CONTENT_DIR}\//${PUBLIC_DIR})\//g ; done

…or something like that (I didn’t try that out, but I think you can see what I’ve done)

The reason I suggest this is that it seems like your Make command is exiting with status code 1 and I am trying to understand what could be causing that.