I am coming back to a Node JS script after some time. I am in my development directory/folder with many test JS scripts. I load the script that, by name, looks like the one I want to run. It has the most recent date which supports this point of view. I run the following command:
C:\testscripts>node .
It runs the script successfully. But I can't see how this has happened. My script is what's largely contained in GoogleDrive for Developers Node JS Quickstart I look at the requires, scopes, credentials etc but can't figure out how my dev environment 'knows' which script to run when I use the generic command above?
So I can also run the same script using it's name.
C:\testscripts>node gdocToTextDownload.js
But what is it that lets me leave the file name out and still get the same result? I would appreciate a suggestion here.
CodePudding user response:
Node looks at the main
field of package.json
and runs the file listed there.