seanmcp.com

Fix Netlify Dev's 'Multiple possible start commands found' issue

Netlify Dev attempts to guess what framework your project is using and what commands it should run in development.

$ netlify dev

◈ Netlify Dev ◈
◈ Ignored general context env var: LANG (defined in process)
◈ Ignored general context env var: LC_ALL (defined in process)
? Multiple possible start commands found (Use arrow keys or type to search)[Astro] 'npm run dev'
  [Svelte] 'npm run dev'
  [Svelte] 'npm run build'

Reading the Netlify documentation, it seems like you should be able to resolve this by adding a [dev] section to your netlify.toml file.

<!-- This doesn't work -->
[dev]
    command = "npm run dev"

However, that alone does not work. There is a "closed" issued that describes the behavior, but essentially the Netlify CLI doesn't read the command even though you've set it.

Thankfully, someone contributed an actual solution that only requires a few more details:

[dev]
    command = "npm run dev"
    framework = "#custom"
    targetPort = 3000

framework needs to be set to "#custom" and you need to manually set the port that your dev server typically runs on. With Astro, that is port 3000.

With that configured, everything works as expected:

$ npx netlify dev

◈ Netlify Dev ◈
◈ Ignored general context env var: LANG (defined in process)
◈ Ignored general context env var: LC_ALL (defined in process)
◈ Setting up local development server

Happy coding!

Reply by email Romans 5:8