
Node -title=MyWebsite -stack-trace-limit=25. To run the application with the same Node.js flags and the Contrast agent, you could use either of these commands: node -title=MyWebsite -stack-trace-limit=25. Without the Contrast agent, you start your application like this: node -title=MyWebsite -stack-trace-limit=25. You can use either of these as the script argument when starting the application this way. When the agent is installed, a symlink is created, /node_modules/.bin/node-contrast, which points to the file /node_modules/node_contrast/cli.js. To pass command line flags to Node.js, you must invoke node explicitly with the agent as the script argument, followed by the name of the application's entry point file and any configuration flags, as shown above. The agent doesn't pass any flags to the underlying Node.js executable, or provide the ability to do so with agent configuration options. The Contrast agent is a Node.js wrapper (runner) that invokes node to start the application. Will pass appArg0 foo and appArg1 bar directly to the application.įor command line arguments, the Node.js documentation shows that scripts are executed like this: node $ echo "console.log(globalThis.foo)" > index.To pass configuration options to the application being run with Contrast, use the -application.args flag, or append - to the run command, followed by the arguments for the application.įor example: npm run contrast debug -appArg0 foo -appArg1 bar $ node -snapshot-blob snapshot.blob -build-snapshot snapshot.js # Run snapshot.js to intialize the application and snapshot the # state of it into snapshot.blob. If no script filename or eval/print script is supplied prior to this, then the next argument is used as a script. $ echo "globalThis.foo = 'I am from the snapshot'" > snapshot.js Pass the rest of the arguments to the script. The generated blob will be written, by default, to snapshot.blob When building the snapshot, if -snapshot-blob is not specified, Generates a snapshot blob when the process exits and writes it toĭisk, which can be loaded later with -snapshot-blob. When loading ECMAScript module loader loads the program entry point, the nodeĬommand will only accept as input only files with. ECMAScript modules loader entry point caveat # Otherwise, the file is loaded using the CommonJS module loader. Package.json file contains a top-level "type" field with a value of Point to be loaded with ECMAScript module loader. The program was started with a command-line flag that forces the entry.

If a file is found, its path will be passed to the ECMAScript module loader If noĬorresponding file is found, an error is thrown. That path is then resolved by CommonJS module loader. It is extremely configurable to support a wide variety of use cases. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.
If the string is not anĪbsolute path, it's resolved as a relative path from the current workingĭirectory. npmThe program entry point is a specifier-like string. Node Įxecute without arguments to start the REPL.įor more info about node inspect, see the debugger documentation.
#NODEJS COMMAND LINE ARGUMENTS MANUAL#
To view this documentation as a manual page in a terminal, run man node. These options expose built-inĭebugging, multiple ways to execute scripts, and other helpful runtime options.

Node.js comes with a variety of CLI options.

-force-node-api-uncaught-exceptions-policy.-disallow-code-generation-from-strings.ECMAScript modules loader entry point caveat.
