Conversation
The process argument handling is different from Deno and NodeJS. The following script in Deno: ``` shellsession $ deno script.ts hello world ``` will set `Deno.args` to `["hello", "world"]`. By contrast, the following in NodeJS: ``` shellsession $ node script.mjs hello world ``` will set `process.argv` to `["/path/to/node","/abs/path/to/script.mjs", "hello", "world"]` The NodeJS way is similar to the argv of a `Bash` script, but the Deno way is more practical. This normalizes Node to behave like Deno, only passing the user arguments to the script. We can explore how to get the script name and the executable name later.
taras
pushed a commit
that referenced
this pull request
Nov 12, 2025
🐞Fix arguments passed to NodeJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The process argument handling is different from Deno and NodeJS. The following script in Deno:
$ deno script.ts hello worldwill set
Deno.argsto["hello", "world"]. By contrast, the following in NodeJS:$ node script.mjs hello worldwill set
process.argvto["/path/to/node","/abs/path/to/script.mjs", "hello", "world"]The NodeJS way is similar to the argv of a
Bashscript, but the Deno way is more practical.Approach
This normalizes Node to behave like Deno, only passing the user arguments to the script. We can explore how to get the script name and the executable name later.