debugging

Execute a JavaScript file or start a REPL session with Node.js runtime.

php artisan node

Syntax

Syntax
node [script.js] [--inspect]

Explanation

Runs JavaScript outside the browser. Without arguments, starts an interactive REPL. --inspect enables the Node.js debugger for debugging with Chrome DevTools. --watch auto-restarts on file changes (Node 18+).

Example

Example
node --inspect server.js

Explanation

Runs JavaScript outside the browser. Without arguments, starts an interactive REPL. --inspect enables the Node.js debugger for debugging with Chrome DevTools. --watch auto-restarts on file changes (Node 18+).