Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if no file is specified use package.json's main property #14

Closed
dylang opened this issue Mar 6, 2011 · 9 comments
Closed

if no file is specified use package.json's main property #14

dylang opened this issue Mar 6, 2011 · 9 comments

Comments

@dylang
Copy link

dylang commented Mar 6, 2011

A simple short for lazy developers - if no command line arguments and package.json exist then use the main property.

EDIT: was use index.js

@visnup
Copy link

visnup commented Mar 18, 2011

or check for a package.json file in the directory and use it's main entry.

@dylang
Copy link
Author

dylang commented Mar 19, 2011

I like that even better. Updating description...

@remy
Copy link
Owner

remy commented Apr 23, 2011

On it.

@remy remy closed this as completed in 88269ba Apr 23, 2011
@dylang dylang reopened this Apr 24, 2011
@remy
Copy link
Owner

remy commented May 1, 2011

Why reopened? This change was applied in the last change to nodemon and released to npm...

@dylang
Copy link
Author

dylang commented May 2, 2011

i reopened because i didn't see the change in the changelist associated with this but i must have done something wrong because my comment wasn't included and the feature works now.

thanks a ton for adding it!

@dylang dylang closed this as completed May 2, 2011
@remy
Copy link
Owner

remy commented May 2, 2011

The change was here if you're interested: 88269ba#L1R129

@visnup
Copy link

visnup commented May 25, 2011

<3 <3 <3 <3

@benjamine
Copy link

this doesn't work for me, main is not intended to start the app, it would be nicer if we looked for a npm start (ie. scripts.start in package.json), and run that command as using npm --exec

@FagnerMartinsBrack
Copy link

FagnerMartinsBrack commented Nov 30, 2023

Makes no sense, this is ridiculous. Using "main" violates the principle of least astonishment. Node CLI DOES NOT uses "main" for starting the server, that's used for import clients not server start clients.

I'm using the same project as a import to other bounded contexts to be able to execute code owned by one domain boundary and the server startup that uses npm run dev to start a specific server file using nodemon start-server. My npm start uses node start-server which works.

How do I prevent this completely unexpected and erroneous behaviour? Any workaround?

Please guys, avoid trying to do magic, I beg you. Nodemon is a great tool don't destroy it. I can open a PR reverting this if you want.

This needs urgent reopening. Sorry if my tone sounds too demanding, just to express the frustration, I hope you don't take personally.

Great work with nodemon!

EDIT: solution was to use node --watch-path=./src start-server in NodeJS v18[1]. No workaround found.

1: https://nodejs.org/api/cli.html#--watch-path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants