-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
nodemon .\src\server.js first second vs nodemon first second help... #1758
nodemon .\src\server.js first second vs nodemon first second help... #1758
Comments
nodemon .\src\server.js first second
vs nodemon first second
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. |
This is slightly buggy, but not the way you think. The So we should see:
The question is, where is But to solve your problem, you want to pass to your script, so you tell nodemon to stop slurping:
However, that doesn't quite work, so I'm filing as a bug. |
Fixes #1758 The combination of using a package.main (which sets the script position to index zero) and using the -- stop slurp meant that the arguments had the script appended to the end instead of prepended to the start. The net result meant that when the script was forked, it would drop the first user arg. See diff for details of the fix - a simple check against null.
* fix: package.main with -- arguments Fixes #1758 The combination of using a package.main (which sets the script position to index zero) and using the -- stop slurp meant that the arguments had the script appended to the end instead of prepended to the start. The net result meant that when the script was forked, it would drop the first user arg. See diff for details of the fix - a simple check against null. * fix: protect against missing opts
nodemon -v
:2.0.4
node -v
:v14.8.0
OS
: Windows 10, Powershell, macOSI have a quick question that has perplexed me since I started using nodemon. Here's the relevant section from my package.json:
If I execute
nodemon .\src\server.js first second
thenconsole.log(process.argv)
looks like:However, if I want to take advantage of nodemon's ability to automatically run the file associated with the
main
property of mypackage.json
file, and I executenodemon first second
, thenconsole.log(process.argv)
looks like:The first argument gets eaten.
Expected behaviour
I expect nodemon to determine that
first
isn't a Node application, so it should load the file associated with themain
property of mypackage.json
file, and then pass myfirst
andsecond
arguments to it. I expectconsole.log(process.argv)
to look like:Actual behaviour
My arguments are jumbled up. My second argument appears as the first argument, my first argument doesn't appear at all, and my file associated with the
main
property of mypackage.json
file appears as the second argument.Steps to reproduce
Show above.
nodemon has been around forever and is wonderful, so I assume that I'm being an idiot and there's just something I don't understand. I want the ease of being able to enter commands like:
and:
so I can easily switch environments. I don't want to have to type in my main
.\src\server.js
every time like this:Thanks!
The text was updated successfully, but these errors were encountered: