Skip to content

Infinite calls when "main" is missing and start script runs nodemon #2258

@efekrskl

Description

@efekrskl
  • Versions: node@v22.21.0, darwin@24.6.0
  • nodemon -v: 3.1.10
  • Operating system/terminal environment (powershell, gitshell, etc): macOs, fish shell
  • Using Docker? What image: No
  • Command you ran: nodemon <filename>

Expected behaviour

If the target file doesn't exist or can't be resolved, nodemon shouls fail to start (e.g file not found)

Actual behaviour

Nodemon spawns itself infinitely

Image

Steps to reproduce

Have a nodejs project

npm init -y

Remove the main entry point from package.json

npm pkg delete main

Have a start script or similar (npx nodemon file_doesnt_exist.js should also be enough)

npm pkg set scripts.start="nodemon file_doesnt_exist.js"

Run command

npm run start

Notes

This first occurred after running npx express-generator, which creates a default package.json without a main field. So this probably isn't a contrived setup


If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions