2015-10-22 08:31:52 +01:00
|
|
|
# node
|
2014-03-05 20:37:38 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> Server-side JavaScript platform (Node.js).
|
2019-06-03 01:06:36 +01:00
|
|
|
> More information: <https://nodejs.org>.
|
2014-03-05 20:37:38 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Run a JavaScript file:
|
2015-12-25 22:17:46 +00:00
|
|
|
|
2020-07-28 06:44:44 +01:00
|
|
|
`node {{path/to/file}}`
|
2015-12-25 22:17:46 +00:00
|
|
|
|
2016-02-28 20:09:02 +00:00
|
|
|
- Start a REPL (interactive shell):
|
2014-03-05 20:37:38 +00:00
|
|
|
|
|
|
|
`node`
|
|
|
|
|
2022-10-17 03:04:15 +01:00
|
|
|
- Execute the specified file restarting the process when an imported file is changed (requires Node.js version 18.11+):
|
|
|
|
|
|
|
|
`node --watch {{path/to/file}}`
|
|
|
|
|
2020-10-22 17:30:16 +01:00
|
|
|
- Evaluate JavaScript code by passing it as an argument:
|
2014-03-05 20:37:38 +00:00
|
|
|
|
2015-12-25 22:17:46 +00:00
|
|
|
`node -e "{{code}}"`
|
2019-01-11 00:35:23 +00:00
|
|
|
|
2023-04-08 13:50:02 +01:00
|
|
|
- Evaluate and print the result, useful to print node's dependencies versions:
|
2019-01-11 00:35:23 +00:00
|
|
|
|
2023-04-08 13:50:02 +01:00
|
|
|
`node -p "process.versions"`
|
2020-07-22 19:33:50 +01:00
|
|
|
|
2020-07-28 22:22:23 +01:00
|
|
|
- Activate inspector, pausing execution until a debugger is connected once source code is fully parsed:
|
2020-07-22 19:33:50 +01:00
|
|
|
|
2020-07-28 06:44:44 +01:00
|
|
|
`node --no-lazy --inspect-brk {{path/to/file}}`
|