Reputation: 1139
could someone help me understand the difference between running a node script from terminal using ./ [Filename]
versus running it with node [filename]
?
Thank you very much.
Upvotes: 0
Views: 80
Reputation: 51480
It's the same as running bash script using ./[Filename]
or bash [Filename]
.
To use ./[Filename]
syntax your node script should:
chmod +x [Filename]
)#!/usr/bin/node
or #!/usr/bin/env node
)There is no requirements for running your script with node [Filename]
.
Upvotes: 2