Closed jared-at-devmountain closed 1 year ago
I'm not at a computer ATM, but the behaviour should follow what node .
would do. Appreciate it's slightly different syntax but it's what I set off with originally.
If you can test that with the same directory set up and let me know what happens then I can decide what to do from there.
@remy I tested it, and the commands nodemon
and node .
behave differently (the former runs index.js, and the latter runs server.js). I've attached an image of my tests' console logs for your benefit:
.
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
Simply commenting here so that the issue isn't closed.
:tada: This issue has been resolved in version 3.0.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Expected behaviour
See stackoverflow question: https://stackoverflow.com/questions/72946313/
npm project js file can be run by the nodemon command without arguments as long as "main" set in package.json file. For example, if main was set to "server.js", when I run "nodemon", then what happens should be equivalent to "nodemon server.js". It shouldn't matter if there is an "index.js" file at the root of my project, the "nodemon" command should still run "nodemon server.js"
Actual behaviour
When there is an "index.js" file at the root of my project, it doesn't matter what the "main" attribute is in "package.json": it will always try to run "index.js" at root when I run "nodemon".
Steps to reproduce
Make a directory cd to that directory and make a new npm project with 'npm init -y' in the package.json file, set main to "server.js" make a server.js file at the root of the project, have it filled with some simple code, perhaps a simple Express app make a index.js file at root, have it filled with some simple code run
nodemon
Environment
nodemon 2.0.16 macOS Monterey 12.4 zsh 5.8.1 (x86_64-apple-darwin21.0) npm 1.5.5 node 16.15.0