Netlify dev indicates 'no "command" specified'

Hi there :wave:,

When running netlify dev I get the following message:

◈ No app server detected and no “command” specified

netlify dev cli screenshot

However, in my netlify.toml file, I have specified a build command:

[build]
  publish = "_site"
  command = "npm run build"

The consequence is that when running netlify dev, it never actually executes npm run build and my site output is not generated.

Here’s a sample project

Github: GitHub - KyleMit/netlify-dev-test: Test case for running netlify dev locally
Netlify: https://netlify-dev-test-kylemit.netlify.app/

The site runs just fine on production, but I’d love to be able to put in some dev cycles locally

Any ideas as to how I can convince netlify dev that I have a local “app server” or “command”?

Thanks!

Hey @KyleMit,
I believe you have to specify a build command in a flag:

Could you give that a try and let us know if it works better for you?

1 Like

Thanks so much @jen! I was thinking netlify dev would pick up from configuration settings from the [build] block. In looking at the documentation you provided, realized I need to pass in the command flag, as you mentioned, or specify dev server instructions in the [dev] block.

So I’ve added the following to my netlify.toml:

[dev]
  framework = "#custom"
  command = "npm run build && cd _site && npx live-server"
  publish = "_site"
  targetPort = 3000

I was thinking that netlify dev might host it’s own static site server from the publish directory, but I can’t get that to work even when using framework = #static, so I’m using npx live-server instead to host the built files.

Also, thanks for the quick reply and sorry for the late response on my end - I have email notifications turned on now :slight_smile:

1 Like